Keep MSTest.Sdk in sync with MSTest framework to fix NativeAOT test discovery - #55302
Merged
dsplaisted merged 2 commits intoJul 15, 2026
Merged
Conversation
…iscovery The test/dotnet-aot.Tests project publishes as NativeAOT and relies on the MSTest source generator for test discovery (reflection isn't AOT-safe). That requires MSTest.Sdk (the MSBuild SDK pinned in global.json) and the MSTest framework packages (MSTestPackageVersion, flowed by darc from microsoft/testfx) to be coherent. A dotnet/dotnet flow bumped MSTestPackageVersion to 4.4.0-preview.26360.5 while MSTest.Sdk stayed at 4.3.0-preview.26325.12, and PR dotnet#54719 then enabled the NativeAOT CLI test leg. The SDK/framework skew makes the source generator register zero tests, so the leg fails with MTP exit code 8 (Test run summary: Zero tests ran) on every main build. Normal reflection-based MSTest runs tolerate the skew, so only the AOT leg breaks. Fix: bump MSTest.Sdk to 4.4.0-preview.26360.5 (same testfx build as the MSTest framework), and track MSTest.Sdk as a darc dependency in eng/Version.Details.xml. Like Microsoft.DotNet.Arcade.Sdk and .Helix.Sdk, darc then updates its global.json msbuild-sdks version in lockstep with the MSTest framework packages, preventing the versions from drifting apart again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 59570d89-a7e3-4993-baa9-3fb1f442a617
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
baronfel
approved these changes
Jul 15, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the pinned MSTest.Sdk MSBuild SDK version and starts tracking it as a darc-managed dependency so it stays aligned with the MSTest framework packages—fixing NativeAOT MSTest discovery where version skew can lead to zero discovered tests.
Changes:
- Bump
MSTest.Sdkinglobal.jsonmsbuild-sdksto4.4.0-preview.26360.5. - Add
MSTest.Sdkas a dependency ineng/Version.Details.xml(frommicrosoft/testfx) so darc can keep theglobal.jsonpin in sync with MSTest.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| global.json | Updates the pinned MSTest.Sdk MSBuild SDK version used by the repo. |
| eng/Version.Details.xml | Adds MSTest.Sdk as a tracked dependency so darc updates it alongside MSTest/TestFX flows. |
Member
|
Nice! I have a crappier version of this over in my PR but yours fixes the root cause of the out-of-sync. |
baronfel
enabled auto-merge (squash)
July 15, 2026 19:02
baronfel
disabled auto-merge
July 15, 2026 19:02
dsplaisted
enabled auto-merge
July 15, 2026 19:45
…um 843419) The 'AoT: windows (arm64)' cross-build leg added in dotnet#55205 has never passed: the win-arm64 NativeAOT cross-link fails with 'LNK1322: cannot avoid potential ARM hazard (Cortex-A53 MPCore processor bug #843419)' because the ILCompiler-produced object is not split into per-function sections, so the MSVC arm64 linker cannot apply the erratum fixup. Only win-arm64 is affected (win-x64, osx-arm64, linux-x64/arm64 AoT legs all pass). Set disableJob: true on the win-arm64 AoT job parameter set in .vsts-pr.yml and .vsts-ci.yml to stop it red-walling every build until the underlying ILCompiler fix lands. Re-enable by removing disableJob. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 59570d89-a7e3-4993-baa9-3fb1f442a617
baronfel
approved these changes
Jul 15, 2026
pull Bot
pushed a commit
to AraHaan/sdk
that referenced
this pull request
Jul 20, 2026
Bumps the microsoft/testfx dependency group to the latest coherent build
(4.4.0-preview.26366.2 / MTP 2.4.0-preview.26366.2, testfx c1e6453) across all
three places that must agree:
- global.json msbuild-sdks -> MSTest.Sdk (the source generator)
- eng/Version.Details.props -> MSTestPackageVersion + MicrosoftTestingPlatformPackageVersion
- eng/Version.Details.xml -> MSTest, MSTest.Sdk, Microsoft.Testing.Platform (+ Sha)
The MSTest.Sdk source generator emits test registrations against the
MSTest.TestFramework runtime, so these must come from the same testfx build.
A skew breaks the NativeAOT CLI test build ("Zero tests ran" when the generator
lags, CS0234 on DynamicDataSourceResolver when it leads). Adds KEEP-IN-SYNC
comments over each version so future manual edits keep them together. See dotnet#55302.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1b315003-e0fc-4a09-865e-c8f4750fe3a5
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.
We had mismatched versions of the MSTest.Sdk and the MSTest package references. Apparently this no longer works when using NativeAOT tests. So this adds a declared dependency to MSTest.Sdk so the reference in global.json will get updated in sync.
EDIT: Also updated to temporarily disable win-arm64 NativeAOT (AoT) CI leg. This was added in #55205 but has never passed, and is failing with errors like
Verbose Copilot description
The
test/dotnet-aot.Testsproject publishes as NativeAOT and relies on the MSTest source generator for test discovery (reflection-based discovery isn't AOT-safe). That requires two versions to stay coherent:MSTest.Sdk— the MSBuild SDK, pinned inglobal.json(msbuild-sdks), which provides the NativeAOT discovery targets + source generator.MSTestPackageVersion(theMSTestframework/runtime packages) — flowed by darc frommicrosoft/testfx.A
dotnet/dotnetflow bumpedMSTestPackageVersion4.3.0-preview.26355.11→4.4.0-preview.26360.5, butMSTest.Sdkstayed pinned at4.3.0-preview.26325.12inglobal.json. Shortly after, #54719 enabled theRun NativeAOT CLI Testsleg for the first time.With the SDK (4.3.0) and framework (4.4.0) skewed, the MSTest source generator registers zero tests, so the AOT binary reports
Test run summary: Zero tests ranand exits with MTP code 8 — failing the leg on everymainbuild. (Normal reflection-based MSTest runs tolerate the skew, so only the AOT leg breaks.)#54719 itself was green because it was validated while MSTest was still coherent at 4.3.0; it merged into a
mainthat had already moved the framework to 4.4.0.Fix
global.json— bumpMSTest.Sdkto4.4.0-preview.26360.5(samemicrosoft/testfxbuild as theMSTestframework packages), re-cohering the source generator with the runtime.eng/Version.Details.xml— trackMSTest.Sdkas a darc dependency frommicrosoft/testfx, next toMSTest.Why this keeps them in sync going forward
Microsoft.DotNet.Arcade.SdkandMicrosoft.DotNet.Helix.Sdkalready live in bothglobal.jsonmsbuild-sdksandeng/Version.Details.xml, so darc keeps theirglobal.jsonversions updated in lockstep with the flow.MSTest.Sdkwas the odd one out —global.jsononly, hand-bumped, free to drift. Tracking it inVersion.Details.xmlmakes darc updateMSTest.Sdkinglobal.jsontogether with theMSTestframework packages on everytestfxflow. Sincetestfxpublishes both at the same build/version string, they can no longer drift apart.Verification
darc get-dependenciesparses the newMSTest.Sdkdependency.global.jsonis valid JSON;eng/Version.Details.xmlis well-formed.MSTest.Sdk 4.4.0-preview.26360.5is present on thedotnet-tools/test-toolsfeeds and matchesMSTest 4.4.0-preview.26360.5(buildf19af28).Fixes the
Run NativeAOT CLI Testsfailures introduced alongside #54719.