Enable multithreaded MSBuild in acceptance tests - #11011
Enable multithreaded MSBuild in acceptance tests#11011Amaury Levé (Evangelink) wants to merge 6 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b4738829-82a2-4f5d-9ba6-f7d88ed654c7
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The command classification and multithreading configuration correctly match the documented execution modes.
Review tier: Balanced
Findings: None
What changed in this PR
Enables multithreaded MSBuild for MTP and MSTest acceptance-test invocations.
Changes:
- Adds opt-in multithreading for
dotnet buildand project-baseddotnet test. - Excludes assembly-based test execution.
| File | Description |
|---|---|
DotnetCli.cs |
Detects MSBuild-backed commands and configures multithreading. |
AcceptanceFixture.cs |
Enables the behavior for both linked acceptance suites. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b4738829-82a2-4f5d-9ba6-f7d88ed654c7
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Explicit opt-outs can be defeated by inherited environment variables, and project-based tests can be misclassified as assembly-based.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 2
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs — The per-call opt-outs are not deterministic because RunAsync first copies the parent environment.… |
|
test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs — This classifies a test as assembly-based when .dll or .exe occurs anywhere in the command line,… |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b4738829-82a2-4f5d-9ba6-f7d88ed654c7
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Direct --test-modules invocations can be misclassified and receive unsupported MSBuild arguments.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs — --test-modules is also a direct-module selector and bypasses MSBuild (see… |
Issues resolved since last review (2)
| Severity | Finding |
|---|---|
test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs — This classifies a test as assembly-based when .dll or .exe occurs anywhere in the command line,… View resolved comment |
|
test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs — The per-call opt-outs are not deterministic because RunAsync first copies the parent environment.… View resolved comment |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b4738829-82a2-4f5d-9ba6-f7d88ed654c7
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Optional --list-tests parsing can skip a following --test-modules selector and misclassify direct test execution.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs — --list-tests has optional arity, but this unconditional skip treats the next option as its value.… |
Issues resolved since last review (1)
| Severity | Finding |
|---|---|
test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs — --test-modules is also a direct-module selector and bypasses MSBuild (see… View resolved comment |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b4738829-82a2-4f5d-9ba6-f7d88ed654c7
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Direct test invocations can be misclassified because the value-taking option table omits valid options.
Review tier: Balanced
Findings: None
Issues resolved since last review (1)
| Severity | Finding |
|---|---|
test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs — --list-tests has optional arity, but this unconditional skip treats the next option as its value.… View resolved comment |
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs:10
- The value-taking option table is incomplete: valid options such as
--verbosityand--blame-hang-dump-typeare omitted. For example,test --verbosity normal MyTests.dlltreatsnormalas the positional target, returnsfalsebefore reaching the DLL, and then adds multithreaded-MSBuild state plus an MSBuild binlog to a direct test invocation. Please add the missing aliases (with parser tests), or make detection continue past unrecognized option values safely.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b4738829-82a2-4f5d-9ba6-f7d88ed654c7

Summary
dotnet buildcalls with-mtdotnet testthroughMSBUILDENABLEMULTITHREADED=1Testtarget scenarios whose tasks do not support multithreaded execution yetdotnet testexecution unchanged because it bypasses MSBuildLocal performance report
Environment: Windows 11 Enterprise 10.0.26200; AMD Ryzen AI Max+ 395 (16 cores/32 logical processors); 47.8 GB RAM; .NET SDK 11.0.100-rc.2.26425.121; MSBuild 18.11.0.42621.
The benchmark used generated, multi-targeted MSTest acceptance assets (
net10.0,net8.0, andnet462). Acceptance tests ran with 32 method-level workers and a fresh randomized NuGet package directory per test-assembly invocation.Four-case samples were 19.420s, 20.570s, and 13.990s without multithreading versus 18.210s, 17.320s, and 17.870s with multithreading. All measured tests passed. The smaller sample is noisy, but both scenarios showed improvement and the larger concurrent scenario showed the strongest gain.
Integration findings
The Microsoft.Testing.Platform mode of
dotnet testdoes not accept the raw MSBuild-mtswitch; it treats it as an unmatched platform option and test applications fail their handshake. This change therefore passes-mtdirectly todotnet build, while project-baseddotnet testuses MSBuild's equivalentMSBUILDENABLEMULTITHREADED=1environment input.Two task paths currently need explicit opt-outs:
JsonToItemsTaskFactorycannot run in the out-of-process TaskHost selected by-mt.InvokeTestingPlatformTaskdoes not yet preserve its terminal summary and output artifacts in that TaskHost, so acceptance scenarios that directly exercisebuild -t:Testremain single-process.Validation
build.cmd -pack -blbuild -t:Testmatrix and browser-WASM buildTesttarget opt-outs and ordinary multithreaded build/test paths