Validate unique UIDs when assembling data consumers in BuildTestFrameworkAsync #7079
+35
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
ValidateUniqueExtensioncalls inRegisterAsServiceOrConsumerOrBothAsyncbefore adding consumers todataConsumersBuilderpushOnlyProtocolDataConsumerto bothtestSessionLifetimeHandlersanddataConsumersBuilderabortForMaxFailedTestsExtensiontodataConsumersBuildertestSessionLifetimeHandlersInvalidOperationExceptionwhen added to existing collectionsThis 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/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)/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)/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/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
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.