Add MSBUILDDEBUGONSTART=3 to skip debugging TaskHost child processes#12679
Merged
Add MSBUILDDEBUGONSTART=3 to skip debugging TaskHost child processes#12679
Conversation
Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add check for sidecar taskhost in MSBUILDDEBUGONSTART
Add MSBUILDDEBUGONSTART=3 to skip debugging TaskHost child processes
Oct 20, 2025
JanProvaznik
requested changes
Oct 20, 2025
Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
JanProvaznik
approved these changes
Oct 20, 2025
Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds support for MSBUILDDEBUGONSTART=3 to launch the debugger only for the main MSBuild process while skipping TaskHost processes. Key changes introduce a detection helper (IsInTaskHostNode), conditional debugger launch logic in XMake, a no-op case in OutOfProcTaskHost, and updated documentation plus a unit test.
- Added IsInTaskHostNode() to identify TaskHost context.
- Added case "3" handling in XMake.cs and OutOfProcTaskHost.cs.
- Updated docs and added a single test for the new helper.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Shared/Debugging/DebugUtils.cs | Adds IsInTaskHostNode() helper for node mode detection used by debugger logic. |
| src/MSBuild/XMake.cs | Adds conditional debugger launch for value "3" skipping TaskHost nodes. |
| src/MSBuildTaskHost/OutOfProcTaskHost.cs | Adds case "3" that intentionally skips launching debugger in TaskHost. |
| src/Build.UnitTests/BackEnd/DebugUtils_tests.cs | Adds unit test covering false (central node) case of IsInTaskHostNode(). |
| documentation/wiki/Building-Testing-and-Debugging-on-Full-Framework-MSBuild.md | Documents new MSBUILDDEBUGONSTART=3 behavior. |
| documentation/wiki/Building-Testing-and-Debugging-on-.Net-Core-MSBuild.md | Documents new MSBUILDDEBUGONSTART=3 usage. |
YuliiaKovalova
approved these changes
Oct 21, 2025
SimaTian
approved these changes
Nov 10, 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.
Summary: Add MSBUILDDEBUGONSTART=3 to skip debugging TaskHost processes
✅ All tasks completed successfully
Changes Made (42 lines added/modified across 6 files):
IsInTaskHostNode()public method to detect if current process is a TaskHostHow to Use:
Set
MSBUILDDEBUGONSTART=3before running MSBuild to debug the main process while skipping both:Available values:
1: Launch debugger for all processes (main + TaskHost)2: Wait for manual debugger attach for all processes3(NEW): Launch debugger for main MSBuild only, skip TaskHost processesDocumentation:
✅ Updated in two wiki pages:
Security:
✅ No security vulnerabilities detected by CodeQL
Testing:
✅ All tests pass (2/2 DebugUtils tests)
✅ Build succeeds with no warnings or errors
✅ Manual verification completed
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.