Implement IBuildEngine3 Yield/Reacquire for out-of-proc task host#13
Draft
Implement IBuildEngine3 Yield/Reacquire for out-of-proc task host#13
Conversation
- Added TaskHostYield and TaskHostReacquire packet types (0x16, 0x17) - Created packet classes for yield/reacquire communication - Updated OutOfProcTaskHostNode to send yield/reacquire packets and wait for acks - Updated TaskHostTask to handle and acknowledge yield/reacquire packets - Added wait handles for yield and reacquire acknowledgments - Properly dispose new wait handles on shutdown Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
- Added TaskHostYield.cs and TaskHostReacquire.cs to Microsoft.Build.csproj - Added TaskHostYield.cs and TaskHostReacquire.cs to MSBuild.csproj - Build now succeeds without errors Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
- Added TestYieldAndReacquire test to TaskHost_Tests.cs - Test verifies that Yield() and Reacquire() can be called without exceptions - Test passes successfully Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
- Register TaskHostYield and TaskHostReacquire packet handlers in TaskHostTask - Ensures proper packet routing and deserialization - Addresses code review feedback Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement yielding in outofproctaskhost for environment switching
Implement IBuildEngine3 Yield/Reacquire for out-of-proc task host
Dec 17, 2025
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.
Context
The out-of-proc task host (OutOfProcTaskHostNode) had stub implementations for
IBuildEngine3.Yield()andReacquire()that did nothing. Tasks running in the out-of-proc host could not signal yield/reacquire operations to coordinate with the parent node.Changes Made
Packet communication protocol:
TaskHostYield(0x16) andTaskHostReacquire(0x17) packet typesOutOfProcTaskHostNode:
Yield()andReacquire()now send packets to parent node and block on acknowledgment wait handles_yieldAcknowledgedEventand_reacquireAcknowledgedEventwith proper disposalTaskHostTask:
HandleTaskHostYield()andHandleTaskHostReacquire()to process packets and send acknowledgmentsProject files:
Testing
Notes
This provides the foundation for tasks to yield control while performing long-running operations. Future work could extend this to support
BuildProjectFilesInParallelfrom yielded tasks (currently returns an error), enabling environment switching and nested builds during yield.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.