Skip to content

Fix SCI binding failure in DTA hosts (main)#15724

Merged
nohwnd merged 15 commits into
microsoft:mainfrom
nohwnd:forward-port-sci-main
May 6, 2026
Merged

Fix SCI binding failure in DTA hosts (main)#15724
nohwnd merged 15 commits into
microsoft:mainfrom
nohwnd:forward-port-sci-main

Conversation

@nohwnd

@nohwnd nohwnd commented Apr 23, 2026

Copy link
Copy Markdown
Member

Fix DTA hosts crashing with FileLoadException on System.Collections.Immutable 8.0.0.0.

Why

SCI 9.0.11 has different assembly versions per TFM: net462 gets 9.0.0.11, netstandard2.0 gets 9.0.0.0. Product assemblies (Common.dll etc.) are netstandard2.0 and compile against SCI 8.0.0.0 (from the SRM 8.0.0 transitive dependency). The nupkg ships SCI 9.0.0.0. DTA loads Common.dll without binding redirects, asks for 8.0.0.0, finds 9.0.0.0 — crash.

Changes

  • Add explicit SCI PackageReference to CoreUtilities and ObjectModel for non-.NETCoreApp targets. This bumps all netstandard2.0 product assemblies to compile against SCI 9.0.0.0, matching the shipped DLL.
  • Extend SCI binding redirect range to 9.0.0.11 (covers the net462 assembly version).
  • Suppress MSB3277 for .NETCoreApp targets — the netstandard2.0-vs-inbox version mismatch is harmless on .NET Core.
  • Fix MSBuildWarningsAsMessages inheritance in packaging projects (was overwriting parent values).
  • Add acceptance test that validates SCI version alignment in nupkg/VSIX layouts.

Fixes #15718

Related PRs: #15722 (rel/18.6), #15723 (rel/18.7)

Copilot AI review requested due to automatic review settings April 23, 2026 16:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Forward-ports the rel/18.5 fix for the System.Collections.Immutable binding mismatch affecting Microsoft.VisualStudio.TestPlatform.Common.dll on .NET Framework hosts without binding redirects (notably Azure DevOps DTA), and adds an acceptance-test regression guard.

Changes:

  • Add explicit System.Collections.Immutable PackageReference for .NETFramework builds in CoreUtilities and ObjectModel to force consistent compile-time SCI references.
  • Add a new DtaLikeHost test asset (net472) that simulates DTA-style consumption of the shipped tools/net462 layout (no binding redirects).
  • Add new acceptance tests that run DtaLikeHost against both the nupkg tools/net462/... layout and the extracted V2.CLI VSIX layout.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/TestAssets/DtaLikeHost/Program.cs Minimal host executable that triggers FastFilter.Builder to force SCI/SRM binding at runtime.
test/TestAssets/DtaLikeHost/DtaLikeHost.csproj Builds the repro host and references shipped Common.dll/ObjectModel.dll from either nupkg tools layout or extracted VSIX layout.
test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DistributedTestAgentScenarioTests.cs New acceptance tests that build/run DtaLikeHost as a regression guard.
src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj Forces SCI version selection for .NETFramework builds via explicit package reference.
src/Microsoft.TestPlatform.CoreUtilities/Microsoft.TestPlatform.CoreUtilities.csproj Forces SCI version selection for .NETFramework builds via explicit package reference.

Copilot AI review requested due to automatic review settings April 24, 2026 09:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread Directory.Build.targets Outdated
Copilot AI review requested due to automatic review settings April 24, 2026 11:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread test/TestAssets/DtaLikeHost/Program.cs
Comment thread src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.csproj Outdated
Copilot AI review requested due to automatic review settings April 24, 2026 12:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Comment thread test/TestAssets/DtaLikeHost/DtaLikeHost.csproj Outdated
Copilot AI review requested due to automatic review settings April 24, 2026 14:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings April 27, 2026 13:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Force .NET Framework product projects to compile against the netstandard2.0
build of System.Collections.Immutable (AssemblyVersion 9.0.0.0) instead of
the net462 build (AssemblyVersion 9.0.0.11). SCI 9.0.11 introduced an AV
divergence between the two TFMs; the nupkg ships the netstandard2.0 DLL, so
compiled metadata must reference 9.0.0.0 for consumers without binding
redirects (e.g. Azure DevOps Distributed Test Agent) to avoid
FileLoadException.

- Directory.Build.targets: ExcludeAssets=compile on SCI PackageReference +
  explicit Reference to netstandard2.0 DLL for .NET Framework product projects
- Extend binding redirect oldVersion to cover 9.0.0.11
- Add DtaLikeHost test asset and acceptance test

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nohwnd
nohwnd force-pushed the forward-port-sci-main branch from 624e723 to e6d27b1 Compare April 27, 2026 15:36
@nohwnd

nohwnd commented Apr 27, 2026

Copy link
Copy Markdown
Member Author

wait we need to ship nestanardd, fixing

@nohwnd nohwnd closed this Apr 27, 2026
@nohwnd nohwnd reopened this Apr 27, 2026
nohwnd and others added 3 commits April 28, 2026 16:32
Add explicit System.Collections.Immutable PackageReference to CoreUtilities
and ObjectModel for non-.NETCoreApp targets (netstandard2.0 + .NETFramework).
This ensures all product assemblies compile against SCI 9.0.0.0 (the
netstandard2.0 assembly version), matching the SCI DLL shipped in nupkgs.

Extend SCI binding redirect oldVersion range to 9.0.0.11 in app.configs
to cover the net462 assembly version from SCI 9.0.11.

Suppress MSB3277 for .NETCoreApp targets in Directory.Build.targets since
the netstandard2.0 SCI 9.0.0.0 reference is harmless on .NET Core (the
runtime loads whatever version is available regardless of the reference).

Fix MSBuildWarningsAsMessages inheritance in packaging projects that was
overwriting parent values instead of appending.

Add acceptance test that validates SCI version alignment in nupkg/VSIX
layouts using PEReader/MetadataReader.

Fixes microsoft#15718

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…i-main

# Conflicts:
#	test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DistributedTestAgentScenarioTests.cs
Copilot AI review requested due to automatic review settings April 28, 2026 14:34
@nohwnd nohwnd changed the title Forward-port SCI binding fix to main Fix SCI binding failure in DTA hosts (main) Apr 28, 2026
This was referenced Jul 17, 2026
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.

18.5.0 introduced an error Could not load file or assembly 'System.Collections.Immutable, Version=8.0.0.0

3 participants