Partially revert #13660: remove NuGet RestoreTask transient TaskHost workaround - #14297
Merged
JanProvaznik merged 3 commits intoJul 9, 2026
Conversation
…ost workaround PR dotnet#13660 routed NuGet's RestoreTask to a transient (non-sidecar) TaskHost in /mt and MSBuild Server modes to avoid leaking NuGet's static singleton state across invocations. This removes that workaround so RestoreTask again follows normal TaskHost routing in all modes, while keeping the generic per-invocation TaskHost diagnostic logging (TaskHostDetails) introduced by the same PR. Removed: - TaskRouter.RequiresTransientTaskHost + RestoreTask allow-list entry - AssemblyTaskFactory forceTransientTaskHost branch (useSidecarTaskHost reverted) - BuildParameters.IsLongLivedHost / MarkProcessAsLongLivedHost infrastructure - OutOfProcServerNode.MarkProcessAsLongLivedHost() call - Associated TaskRouter integration tests and mock RestoreTask Kept: - TaskHostTask TaskHostDetails diagnostic logging - NodeProviderOutOfProcTaskHost.AcquireAndSetUpHost out-params (hostProcessId, wasNewlyCreated) and localized resource strings Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR partially reverts #13660 by removing the special-case routing that forced NuGet’s RestoreTask to run in a transient (non-sidecar) TaskHost under /mt and MSBuild Server scenarios, returning restore task execution to the normal TaskHost routing behavior. It keeps the generic TaskHost diagnostics additions from #13660.
Changes:
- Removed
TaskRouter.RequiresTransientTaskHostand all RestoreTask-specific allow-list logic. - Removed
BuildParameters.IsLongLivedHost/MarkProcessAsLongLivedHost()plumbing and the server-node initialization hook. - Deleted the associated integration tests and mock RestoreTask used to validate the workaround behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs | Removes transient-TaskHost forcing for RestoreTask; restores pre-workaround sidecar selection logic. |
| src/Build/BackEnd/Node/OutOfProcServerNode.cs | Removes server-process “long-lived host” marking used to drive the workaround. |
| src/Build/BackEnd/Components/RequestBuilder/TaskRouter.cs | Deletes the RestoreTask allow-list helper (RequiresTransientTaskHost). |
| src/Build/BackEnd/BuildManager/BuildParameters.cs | Removes the long-lived-host flag/property and its translation. |
| src/Build.UnitTests/BackEnd/TaskRouter_IntegrationTests.cs | Removes tests and mock task validating transient TaskHost behavior for RestoreTask. |
OvesN
approved these changes
Jul 9, 2026
Member
Author
|
autoreviewer locally passed, setting auto-merge |
JanProvaznik
enabled auto-merge (squash)
July 9, 2026 11:28
Member
Author
|
coordinator test hang 👎 |
This was referenced Sep 10, 2026
This was referenced Sep 11, 2026
Merged
Open
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
Partially reverts #13660. That PR added a temporary workaround routing NuGet's
RestoreTaskto a transient (non-sidecar)TaskHostwhen running in/mtor MSBuild Server mode, to prevent NuGet's static singleton state (PluginManager,EnvironmentWrapper) from leaking across build invocations in a long-lived process.This change removes that workaround so
RestoreTaskagain follows normalTaskHostrouting in all modes.What is removed (workaround)
TaskRouter.RequiresTransientTaskHost+ theNuGet.Build.Tasks.RestoreTaskallow-list entryAssemblyTaskFactoryforceTransientTaskHostbranch (useSidecarTaskHostreverted to pre-PR form)BuildParameters.IsLongLivedHost/MarkProcessAsLongLivedHost()infrastructure (field, property, copy-ctor, Translate)OutOfProcServerNode.Run()MarkProcessAsLongLivedHost()callTaskRouter_IntegrationTestscases and the mockNuGet.Build.Tasks.RestoreTaskWhat is kept (generic diagnostics from the same PR)
TaskHostTaskTaskHostDetailsper-invocation diagnostic loggingNodeProviderOutOfProcTaskHost.AcquireAndSetUpHostout hostProcessId, out wasNewlyCreatedparametersTaskHostDetailsresource string and its localized.xlfentriesValidation
Microsoft.Buildbuilds clean (0 warnings/errors)Microsoft.Build.Engine.UnitTests(net10.0) builds clean; remaining 7TaskRouter_IntegrationTestspassNotes
The underlying NuGet static-state issue tracked in #13315 / #12246 should be considered when deciding whether this workaround is still needed.