Skip to content

Run multi-TFM tests sequentially to fix XunitMultiTFM/MStestMultiTFM flakiness - #55197

Merged
nohwnd merged 1 commit into
mainfrom
nohwnd-investigate-xunit-multitfm-flaky
Jul 8, 2026
Merged

nohwnd merged 1 commit into
mainfrom
nohwnd-investigate-xunit-multitfm-flaky

Conversation

@nohwnd

@nohwnd nohwnd commented Jul 8, 2026

Copy link
Copy Markdown
Member

XunitMultiTFM and MStestMultiTFM run dotnet test on a net48;net11.0 project through the legacy VSTest console logger and assert on contiguous substrings like Passed TestNamespace...VSTestXunitPassTestDesktop. DispatchToInnerBuildsWithVSTestTarget fans the TFMs out with BuildInParallel, so both console loggers write to the same redirected stdout and occasionally interleave mid-line — Passed lands on one line, Stack Trace: from the other TFM flushes in between, and the substring assertion fails. Purely timing-dependent, which is why it's rare and won't reproduce on demand.

Pass --property:TestTfmsInParallel=false (the documented knob) so the TFMs run sequentially. Both still run; their output just can't interleave.

Fixes #55194.

…flakiness

These two tests run `dotnet test` on a net48;net11.0 project through the legacy VSTest console logger and assert on contiguous substrings like 'Passed TestNamespace...VSTestXunitPassTestDesktop'. DispatchToInnerBuildsWithVSTestTarget fans the TFMs out with BuildInParallel, so both console loggers write to the same redirected stdout and occasionally interleave mid-line, breaking the substring assertions. Pass --property:TestTfmsInParallel=false so the TFMs run sequentially. Both still run; their output just can't interleave. Fixes #55194.

Co-authored-by: Copilot App <[email protected]>
Copilot AI review requested due to automatic review settings July 8, 2026 15:27
@nohwnd
nohwnd requested a review from a team as a code owner July 8, 2026 15:27
@nohwnd
nohwnd enabled auto-merge (squash) July 8, 2026 15:29

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

This PR addresses intermittent flakiness in dotnet.Tests multi-targeting dotnet test output assertions by ensuring multi-TFM test execution is sequential, preventing interleaved legacy VSTest console output on redirected stdout (fixes #55194).

Changes:

  • Add --property:TestTfmsInParallel=false to the dotnet test invocations used by MStestMultiTFM and XunitMultiTFM.
  • Document in-code why sequential execution is required (stdout interleaving breaks contiguous substring assertions).

@nohwnd
nohwnd merged commit bcfb6be into main Jul 8, 2026
29 checks passed
@nohwnd
nohwnd deleted the nohwnd-investigate-xunit-multitfm-flaky branch July 8, 2026 18:41
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 9, 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.

Flaky: GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.XunitMultiTFM fails with FluentAssertions output mismatch

4 participants