Fix System.Collections.Immutable binding mismatch in Common.dll (rel/18.5)#15720
Merged
nohwnd merged 2 commits intomicrosoft:rel/18.5from Apr 23, 2026
Merged
Fix System.Collections.Immutable binding mismatch in Common.dll (rel/18.5)#15720nohwnd merged 2 commits intomicrosoft:rel/18.5from
nohwnd merged 2 commits intomicrosoft:rel/18.5from
Conversation
Minimal net472 console app that consumes Microsoft.TestPlatform 18.5.0 package the way Azure DevOps' Distributed Test Agent does: references Common.dll from the package's tools/net462/.../TestPlatform layout and runs without any binding redirects in app.config. Constructs a FilterExpressionWrapper with a simple equality filter, which triggers FastFilter.Builder (uses ImmutableDictionary) and forces the CLR to resolve System.Collections.Immutable. Repros the FileLoadException reported by customers: Common.dll metadata requires System.Collections.Immutable v8.0.0.0, but the package ships v9.0.0.0 next to it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Common.dll (net462, shipped in the Microsoft.TestPlatform nupkg and the V2.CLI VSIX) used to have a compiled metadata ref to System.Collections.Immutable 8.0.0.0 while we ship SCI 9.0.0.0 next to it. Hosts without the '1.0.0.0-9.0.0.0 -> 9.0.0.0' binding redirect (Azure DevOps' DTAExecutionHost, some VS components) FileLoadException the moment FastFilter.Builder touches SCI. Fix: add an explicit System.Collections.Immutable PackageReference to CoreUtilities and ObjectModel, gated on TargetFrameworkIdentifier == .NETFramework, so the compile-time SCI ref in the net462 Common.dll is 9.0.0. This only affects the net462 build (the one we ship next to SCI 9.0.0), keeps the netstandard2.0 ref on 8.0.0 to avoid breaking net8.0 datacollector, and touches zero app.config redirects - no VSIX/VS servicing needed. Turn the DtaLikeHost repro into an automated acceptance test with two variants: one against the nupkg's tools/net462/... layout (as DTA consumes it), one against the flat V2.CLI VSIX layout (as VS consumes it). Both load Common.dll with no binding redirects and call FilterExpressionWrapper; before the fix both fail with the customer's FileLoadException. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
/azp run microsoft.vstest |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Apr 23, 2026
This was referenced Apr 28, 2026
Closed
Merged
This was referenced Apr 29, 2026
Open
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Customer hit a
System.Collections.ImmutableFileLoadExceptionon Azure DevOps' Distributed Test Agent (DTAExecutionHost) after it picked upMicrosoft.TestPlatform18.5.0. Root cause:Microsoft.VisualStudio.TestPlatform.Common.dll(net462) has a compiled metadata ref to SCI8.0.0.0, but we ship SCI9.0.0.0right next to it in the package. Any host that doesn't have vstest.console.exe.config's1.0.0.0-9.0.0.0 -> 9.0.0.0binding redirect blows up as soon asFastFilter.BuildertouchesImmutableDictionary.Fix
Explicit
<PackageReference Include="System.Collections.Immutable">inCoreUtilitiesandObjectModel, gated onTargetFrameworkIdentifier == .NETFramework. Only the net462Common.dllgets the new SCI 9.0.0 compile ref - matching the DLL we already ship - and nothing else moves:netstandard2.0Common.dllkeeps SCI 8.0.0 so net8.0datacollector(whose shared framework ships SCI 8.0.0) doesn't get MSB3277.Repro + automated regression guard
New
DtaLikeHosttest asset: minimal net472 exe,AutoGenerateBindingRedirects=false, referencesCommon.dllbyHintPathfrom the shipped layout and callsFilterExpressionWrapper(which triggersFastFilter.Builder). Without the fix it reproduces the customer's exactFileLoadException.New
DistributedTestAgentScenarioTestsin acceptance tests runs the host in two layouts:tools/net462/Common7/IDE/Extensions/TestPlatform/out of the locally-builtMicrosoft.TestPlatformnupkg (as DTA consumes it).Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI.vsix(as Visual Studio consumes it).If any future change lets
Common.dll's SCI/SRM compile refs drift away from the DLLs shipped next to it, both tests fail with the customer-visible error.