Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 7, 2025

Description

The validation for duplicate consumer UIDs only occurred at the manager level (BuildDataConsumersAsync, BuildTestSessionLifetimeHandleAsync), but several system consumers were added directly to collections, bypassing validation entirely.

Changes:

  • Added ValidateUniqueExtension calls in RegisterAsServiceOrConsumerOrBothAsync before adding consumers to dataConsumersBuilder
  • Added validation before adding pushOnlyProtocolDataConsumer to both testSessionLifetimeHandlers and dataConsumersBuilder
  • Added validation before adding abortForMaxFailedTestsExtension to dataConsumersBuilder
  • Added validation before adding ServerPerCallConsumers handlers to testSessionLifetimeHandlers
  • Added unit tests verifying duplicate UIDs throw InvalidOperationException when added to existing collections

This ensures all code paths that assemble the final consumer/handler collections enforce the unique UID constraint, regardless of whether they go through the manager build methods or are added directly.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 96bvsblobprodcus338.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet test --solution TestFx.slnx --filter FullyQualifiedName~TestApplicationBuilderTests.DataConsumer_DuplicatedId_ShouldFail --verbosity normal AddDataConsumer AnalyzerTests.cs-l ep grep -l AddDataConsumer r.cs grep AddDataConsumer essorTests.cs /snap/bin/grep grep (dns block)
    • Triggering command: /home/REDACTED/work/testfx/testfx/.dotnet/dotnet /home/REDACTED/work/testfx/testfx/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/testfx/testfx/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/testfx/testfx/artifacts/toolset/11.0.0-beta.25605.2.txt cture/Constants.cs p/bin/grep AddDataConsumer r.cs grep grep (dns block)
    • Triggering command: /usr/bin/dotnet dotnet test --filter FullyQualifiedName~TestApplicationBuilderTests.DataConsumer_DuplicatedId_ShouldFail --verbosity normal rc.2.25504.7/ t.sdk.maui/10.0.0-rc.2.25504.7/ AddDataConsumer ests.cs cal/bin/grep grep -l AddDataConsumer cture/WellKnownEnvironmentVariables.cs ndor/bin/grep AddDataConsumer s.cs rep grep (dns block)
  • rcxvsblobprodcus328.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet test --solution TestFx.slnx --filter FullyQualifiedName~TestApplicationBuilderTests.DataConsumer_DuplicatedId_ShouldFail --verbosity normal AddDataConsumer AnalyzerTests.cs-l ep grep -l AddDataConsumer r.cs grep AddDataConsumer essorTests.cs /snap/bin/grep grep (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Throw when multiple consumers use the same UID?</issue_title>
<issue_description>In #6897 we had a broken test that was passing because the consumers had the same ID. Is this possible to do in real code or do we fail earlier when trying to register two consumers with the same ID?</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix issue with multiple consumers using the same UID Validate unique UIDs when assembling data consumers in BuildTestFrameworkAsync Dec 7, 2025
Copilot AI requested a review from Evangelink December 7, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Throw when multiple consumers use the same UID?

2 participants