Isolate child dotnet commands from unsafe MSBuild state - #376
Closed
OvesN wants to merge 2 commits into
Closed
Conversation
Remove SDK-specific MSBuild path overrides from child dotnet processes and route exported-solution builds through the isolated launcher. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8c8d3934-edc7-4f26-a1fc-451749254212
Preserve the 10.0.400 stdout-handle fix from PR jaredpar#375 while narrowing its blanket MSBuild environment filter to known unsafe variables. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8c8d3934-edc7-4f26-a1fc-451749254212
OvesN
force-pushed
the
fix/isolate-child-dotnet-environment
branch
from
August 12, 2026 19:15
8bfb3a9 to
215d9f9
Compare
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.
Summary
MSBuild*environment removal to a three-variable denylistMSBUILDENSURESTDOUTFORTASKPROCESSESRoot cause
The .NET CLI sets
MSBuildExtensionsPathandMSBuildSDKsPathfor its selected SDK. A childdotnetcommand can select a different SDK based on its working directory andglobal.jsonroll-forward policy.Inheriting those paths can combine targets and
NuGet.Build.Tasks.dllfrom the parent SDK withMicrosoft.Build.Frameworkfrom the child SDK. The mismatch became visible when newer NuGet tasks began implementingIMultiThreadableTask, producing MSB4062 type-load failures.MSBUILDENSURESTDOUTFORTASKPROCESSESis a separate hazard: reusable MSBuild worker nodes inherit the redirected stdout handle, whileProcessUtilsynchronously waits for stdout EOF. Removing it preserves the subprocess-hang fix introduced by #375.The .NET 10.0.400 SDK bundle itself was verified to contain a matching
Microsoft.Build.Framework; the type-load failure is caused by cross-SDK environment contamination rather than an inconsistent bundle.Why an explicit denylist
PR #375 removed every variable beginning with
MSBuild. This follow-up retains that fix's known unsafe variables while preserving unrelated MSBuild configuration such asMSBuildLoadMicrosoftTargetsReadOnlyandMSBuildExtensionsPath32/MSBuildExtensionsPath64.The denylist is intentionally explicit. Future SDK-injected variables that identify a parent SDK or alter redirected process lifetime should be evaluated and added when necessary.
Compatibility
This changes only internal process-launch behavior and restores the existing intent that child
dotnetcommands select a coherent SDK context.DOTNET_HOST_PATHremains preserved because it identifies the shared muxer.Validation
dotnet build Basic.CompilerLog.slnx -warnaserrorSolutionReaderTests.CryptoKeyFileand every changed solution-build launch path: 22 passed, Unix-only environment-casing test skipped on Windows