Skip to content

Fix potential assembly mismatches for Microsoft.TestPlatform.ObjectModel#54952

Merged
Evangelink merged 2 commits into
dotnet:mainfrom
dsplaisted:pin-testplatform-objectmodel-version
Jun 24, 2026
Merged

Fix potential assembly mismatches for Microsoft.TestPlatform.ObjectModel#54952
Evangelink merged 2 commits into
dotnet:mainfrom
dsplaisted:pin-testplatform-objectmodel-version

Conversation

@dsplaisted

Copy link
Copy Markdown
Member

Pin Microsoft.TestPlatform.ObjectModel to the in-box vstest version

Microsoft.Testing.Extensions.VSTestBridge (pulled in transitively by test projects using MSTest.Sdk/MTP) requests an older Microsoft.TestPlatform.ObjectModel than the in-box vstest shipped by Microsoft.TestPlatform.CLI. Because test projects build into the test SDK layout, that older ObjectModel (and the CoreUtilities / PlatformAbstractions assemblies in the same package) overwrites the newer in-box vstest assemblies, causing 'dotnet test' (VSTest mode) to crash with MissingMethodException: RunConfiguration.get_CreateNoNewWindow.

With central package transitive pinning enabled, adding a PackageVersion entry pins the transitive ObjectModel to the in-box vstest version so the two stay in sync.

Microsoft.Testing.Extensions.VSTestBridge (pulled in transitively by test
projects using MSTest.Sdk/MTP) requests an older Microsoft.TestPlatform.ObjectModel
than the in-box vstest shipped by Microsoft.TestPlatform.CLI. Because test projects
build into the test SDK layout, that older ObjectModel (and the CoreUtilities /
PlatformAbstractions assemblies in the same package) overwrites the newer in-box
vstest assemblies, causing 'dotnet test' (VSTest mode) to crash with
MissingMethodException: RunConfiguration.get_CreateNoNewWindow.

With central package transitive pinning enabled, adding a PackageVersion entry pins
the transitive ObjectModel to the in-box vstest version so the two stay in sync.

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

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

Pins Microsoft.TestPlatform.ObjectModel to the same version as the in-box VSTest shipped via Microsoft.TestPlatform.CLI, preventing transitive dependencies (notably from Microsoft.Testing.Extensions.VSTestBridge) from bringing older TestPlatform assemblies that can overwrite the in-box copies and break dotnet test.

Changes:

  • Add a central PackageVersion entry for Microsoft.TestPlatform.ObjectModel using $(MicrosoftTestPlatformCLIPackageVersion).
  • Document the rationale in Directory.Packages.props to clarify why this transitive pin is needed.

@Evangelink

Copy link
Copy Markdown
Member

/ba-g the test failures are present on main and various PRs

@Evangelink Evangelink merged commit 311e4f9 into dotnet:main Jun 24, 2026
23 of 25 checks passed
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.

3 participants