Repository navigation
Initialize TaskEnvironment in out-of-proc task hosts - #15183
Merged
JanProvaznik merged 2 commits intoOct 2, 2026
Merged
Conversation
Assign the fallback environment before parameter binding and execution, including inside isolated AppDomains. Cover property-only and constructor-injected tasks and update the task-host specifications. Co-authored-by: Copilot App <[email protected]>
JanProvaznik
temporarily deployed
to
copilot-pat-pool
October 1, 2026 11:01 — with
GitHub Actions
Inactive
JanProvaznik
temporarily deployed
to
copilot-pat-pool
October 1, 2026 11:01 — with
GitHub Actions
Inactive
JanProvaznik
temporarily deployed
to
copilot-pat-pool
October 1, 2026 11:02 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The targeted fix preserves existing routing and constructor behavior while providing regression coverage for all affected execution paths.
Review effort: Balanced
Findings: None
What changed in this PR
Restores TaskEnvironment property injection for out-of-process task hosts, including AppDomain-isolated tasks.
Changes:
- Assigns
TaskEnvironment.Fallbackbefore parameter binding and execution. - Performs AppDomain assignments without marshaling
TaskEnvironment. - Adds regression tests and updates threading specifications.
| File | Description |
|---|---|
src/MSBuild/OutOfProcTaskAppDomainWrapperBase.cs |
Implements out-of-process environment injection. |
src/MSBuild.UnitTests/OutOfProcTaskAppDomainWrapper_Tests.cs |
Tests parameterless, constructor-injected, and AppDomain tasks. |
documentation/specs/multithreading/thread-safe-tasks.md |
Documents the restored injection contract. |
documentation/specs/multithreading/taskhost-threading.md |
Updates TaskHost execution sequencing. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Preserve upstream task-parameter conversion and its regression test alongside TaskEnvironment initialization and AppDomain coverage. Co-authored-by: Copilot App <[email protected]>
AR-May
approved these changes
Oct 2, 2026
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
This was referenced Oct 3, 2026
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.
Fixes #13714
Context
The out-of-proc task host passes
TaskEnvironment.Fallbackto environment-taking constructors but never assignsIMultiThreadableTask.TaskEnvironmentafterward. Tasks with only a parameterless constructor and no default initializer are left with a null environment, unlike the in-process execution path. Built-in fallback initializers and constructor injection mask this gap.Changes Made
TaskEnvironment.Fallbackbefore task parameter binding and execution.TaskEnvironmentdoes not cross the boundary.Testing
net11.0, 4/4 onnet472, with no skips. Coverage includes parameter setters, execution, constructor-injected environment identity, and actual AppDomain isolation.Notes
This restores the existing property-injection contract without changing task routing, public APIs, protocols, or diagnostics. Constructor injection remains unchanged. Tests exercise the real task wrapper, not a separate-process launch.