Repository navigation
test: xunit v3 4.0.1 on Microsoft.Testing.Platform - #35
Merged
Merged
Conversation
Closes the migration deferred on 2026-09-10, and supersedes Dependabot's PR #32, which bumped the versions without it and failed the build. xunit.v3 4.0 drops VSTest on the .NET 10 SDK. The error points at a property that cannot fix it: TestingPlatformDotnetTestSupport is the pre-.NET-10 bridge that redirects the VSTest target into InvokeTestingPlatform, and MTP 2.4.0 removed that escape hatch. The error is raised from inside the bridge's own _MTPBeforeVSTest target, guarded on the SDK major version and a variable named _SupportsGlobalJsonTestRunner, so setting the property changes nothing. The SDK says the same thing: `dotnet test --help` on 10.0.401 directs you to global.json. So the opt-in is global.json, and three packages come out rather than up: Microsoft.NET.Test.Sdk the VSTest targets and test host xunit.runner.visualstudio the VSTest adapter coverlet.collector a VSTest data collector The first two cannot work under MTP. The third would be worse than absent: the collect flag would still be accepted and quietly produce nothing. No replacement is added, because nothing in this repository has ever asked for a coverage number. Test projects gain <OutputType>Exe</OutputType>, which Microsoft.NET.Test.Sdk used to supply implicitly. It is in Directory.Build.props conditioned on the project name, because IsTestProject is set by the test SDK targets long after .props is evaluated and a condition on it would silently never match. The filter rewrite the deferred-work entry predicted turned out to be unnecessary. xunit.v3 4.x ships --filter accepting VSTest syntax, so both CI steps, CONTRIBUTING and the corpus-audit instructions are unchanged and still correct. One thing improves for free: a run that executes no tests now exits 8 instead of passing. Measured, not assumed -- a filter matching nothing exits 8 while the real suite exits 0. A filter typo used to be a silent green. Verified on a clean tree: locked-mode restore, Release build, both CI test steps run verbatim, the CLI smoke test, and a test assembly executed directly. 363 tests: 362 pass, 1 skip (the corpus audit). That is the pre-migration count of 362 plus the one performance test the old filter excluded. Also corrects src/Docmd.Cli/packages.lock.json, which still recorded Ooxml.Md.Core at 0.2.3 after the 0.2.4 release. --locked-mode does not catch this: it validates package versions, not the project-reference versions in the same file. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018wZEgtuzaZPswykiGEBxbz
CONTRIBUTING draws a line between a fact the code owns and a dated measurement. A test count is the first kind: a routine commit makes the sentence false and nobody notices. Recording it as a measurement with its date and its commit puts it on the right side of that line, which is the same treatment 0.2.4's timing figures get. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018wZEgtuzaZPswykiGEBxbz
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.
Closes the test-platform migration deferred on 2026-09-10, and supersedes #32 — which bumped the
versions without the migration and failed the build.
Why the property in the error message cannot fix it
xunit.v3 4.0 drops VSTest on the .NET 10 SDK:
TestingPlatformDotnetTestSupport=trueis the documented pre-.NET-10 bridge: it redirects theVSTest target into
InvokeTestingPlatform. MTP 2.4.0 removed that escape hatch, and the error israised from inside the bridge's own target:
It is guarded on the SDK major version alone, so the property cannot suppress it — and the
refusal is conditioned on a better opt-in being available. The SDK agrees:
dotnet test --helpon 10.0.401 says to opt in "via global.json". (
docs/deferred-work.mdguesseddotnet.config;that is a different mechanism and not what this SDK reads. Corrected here.)
What changed
global.jsongains"test": { "runner": "Microsoft.Testing.Platform" }.Microsoft.NET.Test.Sdk,xunit.runner.visualstudio,coverlet.collector. The first twocannot work; the third would be worse than absent, since the collect flag would still be
accepted and quietly produce nothing. No replacement added — nothing here has ever asked for a
coverage number, and
coverlet.mtp/Microsoft.Testing.Extensions.CodeCoverageare recordedin
Directory.Packages.propsfor whoever does.<OutputType>Exe</OutputType>for test projects, whichMicrosoft.NET.Test.Sdkused tosupply implicitly. In
Directory.Build.props, conditioned on the project name:IsTestProjectis set by the test SDK targets long after
.propsis evaluated, so a condition on it wouldsilently never match.
### The test platformsection inCONTRIBUTING, a CHANGELOG entry.
What did not change, against expectation
The deferred-work entry predicted a filter rewrite in four places. It was unnecessary —
xunit.v3 4.x ships
--filteraccepting VSTest syntax, so both CI steps,CONTRIBUTING.mdand thecorpus-audit instructions are unchanged and still correct. The one restriction is that a VSTest
filter cannot be combined with xunit's own
--filter-class/--filter-queryforms, whichnothing here does. No workflow file is touched.
One thing improves for free
A run that executes no tests now exits 8 instead of passing. Measured, not assumed:
Under VSTest a filter that matched nothing was a silent green. That is the repository's own
"beware the vacuous pass" rule, now enforced by the platform.
Verification
Clean tree, every step's real exit code captured (not
$?after a pipe):dotnet restore docmd.slnx --locked-modedotnet build docmd.slnx --no-restore -c ReleaseTeststep, verbatimPerformance gatestep, verbatimPre-migration baseline was 362 total / 361 pass / 1 skip with the same filter. Full suite is
363 — the same tests plus the one performance test the filter excludes.
Incidental
src/Docmd.Cli/packages.lock.jsonstill recordedOoxml.Md.Coreat0.2.3after the 0.2.4release; regenerating the lock files corrected it. Worth knowing that
--locked-modedoes notcatch this — verified by restoring the stale value deliberately, which exits 0. It validates
package versions, not the project-reference versions in the same file, so that field goes stale
on every release and nothing complains.
🤖 Generated with Claude Code
https://claude.ai/code/session_018wZEgtuzaZPswykiGEBxbz