Repository navigation
Enable -nodeReuse in the VMR pipeline - #9410
Merged
Merged
Conversation
Do not merge. Adds -mt 1 and -nodeReuse 1 to baseArguments so a CI test build exercises MSBuild's multi-threaded mode and node reuse across all verticals. Co-authored-by: Copilot <[email protected]> Copilot-Session: 8df1e800-36c4-4797-b8d7-d2c8e23c1342
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Member
Author
|
/azp run dotnet-unified-build-full |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
-mt 1 may break unmigrated wrappers, and -nodeReuse 1 is not honored by some dependencies.
Get a fresh assessment by requesting another Copilot review.
Review tier: Lite
Findings: 1
Open (1)
What changed in this PR
Enables MSBuild multithreading and node reuse in VMR CI builds.
Changes:
- Adds
-mt 1and-nodeReuse 1to shared build arguments. - Applies them across VMR build and test invocations.
| File | Summary |
|---|---|
eng/pipelines/templates/jobs/vmr-build.yml |
Enables the MSBuild options; wrapper compatibility issues require changes before approval. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
ViktorHofer
marked this pull request as draft
September 16, 2026 12:10
Added extra debugging option to baseArguments in vmr-build.yml.
Member
Author
|
/azp run dotnet-unified-build-full |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Roslyn's build substitutes T: as the process-wide TEMP directory and removes the substitution on exit. In the VMR, MSBuild nodes are reused across concurrently building repos, so a node that picks up T: keeps using it after the roslyn build tears it down, failing with MSB6003 in whichever repo reuses that node. Co-authored-by: Copilot <[email protected]> Copilot-Session: 1a253860-f2e5-4806-b72d-6f2efac9805c
Member
Author
|
/azp run dotnet-unified-build-full |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Member
Author
|
/azp run dotnet-unified-build-full |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Restore /p:EnableExtraDebugging=true so MSBUILDDEBUGCOMM traces and 'MSBuild_*.failure.txt' are produced again. They land in MSBUILDDEBUGPATH, which repo-projects sets to the per-repo log dir (artifacts/log/<config>/<repo>), and the pipeline already publishes all of artifacts/log - so they end up in the BuildLogs artifact. Needed to diagnose the MSB4217 'task host node exited prematurely' failures in the Windows legs. MSBuildDebugPathTargetDir (artifacts/msbuild-debug) was only ever passed to MakeDir: nothing pointed MSBUILDDEBUGPATH at it, nothing wrote to it, and artifacts/msbuild-debug isn't published. Remove it. Co-authored-by: Copilot <[email protected]>
A repo build that hangs let the AzDO job run into its own timeout. A canceled job skips the "Copy logs to BuildLogs staging" step, so the published BuildLogs artifact came back empty and there was nothing to diagnose. Cap a single repo build via Exec's Timeout (150 minutes; the longest repo, runtime, takes ~80). On expiry MSBuild kills the whole build process tree and fails the target, which runs the existing OnError targets, so MoveDotNetBuildLogs still moves the hung repo's partial logs into artifacts/log and the job fails normally instead of being canceled. Also switch the log staging and BuildLogs publish steps to always() so a genuine cancellation still collects whatever has been written so far. Co-authored-by: Copilot <[email protected]> Copilot-Session: 9e7e5da7-45e2-4e3e-a93b-05e89821a39c
EnableExtraDebugging turns on a set of MSBuild debug switches that are far too expensive for a default CI run. MSBUILDDEBUGSCHEDULER makes the scheduler write its full state to disk synchronously after every scheduling pass; in build 1600472 that produced a 2.6 GB SchedulerState_*.txt for runtime, on the scheduler's critical path. MSBUILDDEBUGFORCECACHING, MSBUILDDEBUGEVALUATION and MSBUILDLOGTASKINPUTS are similarly costly. Together they slowed the runtime build enough to change the failure mode from a fast MSB4217 into a timeout, which makes it useless as a diagnostic baseline. Split out EnableMSBuildCommTracing, which only sets MSBUILDDEBUGCOMM and produces the MSBuild_CommTrace_PID_*.txt node handshake/connect/reuse traces. That is all the node reuse and task host investigation needs. The pipeline now passes that instead; EnableExtraDebugging still implies it and keeps the heavy switches for targeted local or CI runs. Co-authored-by: Copilot <[email protected]> Copilot-Session: 9e7e5da7-45e2-4e3e-a93b-05e89821a39c
Both MSBuild engines spawn their .NET task hosts from the same bootstrapped SDK, and the task host handshake is salted with the task host's own tools directory rather than the parent's. That salt is therefore identical for a VS MSBuild parent and an SDK MSBuild parent, so a VS parent can adopt a pooled task host that an SDK parent started. The adopted host keeps the packet version of the parent that launched it and serializes its reply at that layout, which the new parent fails to deserialize and reports as MSB4217. Only aspnetcore and wpf build with VS MSBuild, and only on Windows, so the rest of the repos keep node reuse. dotnet/msbuild#14584 fixes the task host side; this carve-out can be removed once the bootstrapped SDK carries that fix. The node reuse arguments move from Directory.Build.props to Directory.Build.targets because ForceDotNetMSBuildEngine is set in the repo project body, which has not been evaluated yet when the props file is imported. See dotnet/msbuild#15062. Co-authored-by: Copilot <[email protected]> Copilot-Session: 9e7e5da7-45e2-4e3e-a93b-05e89821a39c
Removed MSBuild communication tracing settings and related comments to streamline build configuration.
Removed comments and environment variable settings related to MSBuild node reuse and timeouts.
ViktorHofer
marked this pull request as ready for review
September 18, 2026 11:21
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Member
Author
|
/azp run dotnet-unified-build-full |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
akoeplinger
approved these changes
Sep 18, 2026
1 of 4 tasks
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.

Enables MSBuild node reuse for VMR repo builds, plus the fixes that unblock it.
-nodeReuse 1is added tobaseArguments, and theDotNetBuildNodeReuse→CommonArgslogic moves fromrepo-projects/Directory.Build.propstoDirectory.Build.targetsso it can seeForceDotNetMSBuildEngine. It stays off for repos built with VS MSBuild: both engines spawn .NET task hosts from the same bootstrapped SDK and the task host handshake is salted with the task host's own tools directory, so a VS MSBuild parent can adopt a pooled task host started by an SDK MSBuild parent and then fail to deserialize its reply (MSB4217). Fixed task-host-side by Own sidecar TaskHosts so they cannot outlive their owner msbuild#14584; the carve-out can go once the bootstrapped SDK carries that fix (Node reuse lets a .NET task host be adopted by a different-version parent, corrupting TaskHostTaskComplete (MSB4217) msbuild#15062).T:in the VMR. The subst is process-wide state that outlives the build, so a reused node keeps writing to aT:that no longer exists and fails with MSB6003. This is the root-cause fix for the previous workaround, so the per-repoMSBUILDNODEHANDSHAKESALTand theMSBUILDNODECONNECTIONTIMEOUT=90000env vars are removed and nodes are shareable across repo builds again.RepoBuildTimeoutMinutes, 150 in CI). A hung repo build used to run into the job timeout, which cancels the job and skips log collection. A timed-outExeckills the build process tree and fails the target instead, so theOnErrortargets still publish the partial logs. Opt-in: no timeout when the property is unset.succeededOrFailed()→always()conditions soBuildLogsis still collected and published when a job is canceled or times out. Also drops the unusedMSBuildDebugPathTargetDir;MSBUILDDEBUGPATHis unchanged.Build times
Duration of the
Buildstep in this PR's build, against the average of the 7 most recent successfulmainbuilds (minutes):mainavg (n=7)On all seven stable verticals the PR is faster than every one of the 7
mainbuilds, so the win is outside normal run-to-run variance.*
iOSSimulator_Shortstack_arm64swings between 84.3 and 111.4 minutes onmain(32% spread, vs ≤8.6% for every other vertical), so its number here is agent noise rather than a regression.