Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attach VS automatically #9939

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Attach VS automatically #9939

wants to merge 1 commit into from

Conversation

nohwnd
Copy link
Member

@nohwnd nohwnd commented Mar 27, 2024

Fixes #

Context

We crated a utility in vstest to automatically attach child processes back to VS, because having to find them in process tree and manually attach is annoying. Especially figuring out which process is the correct one to attach to, when there are many processes.

A similar approach with Debug.Launch is less manual, but still requires clicking, and does not allow attaching multiple processes to single VS.

This utility solves all that, you simply set env variable (we usually use it without any default breakpoint (what is set as MSBUILDDEBUGNOBP=1 in this PR), so VS attaches and detaches if it does not find any of your breakpoints (e. g. you are debugging a specific task).

Changes Made

Adding $env:MSBUILDDEBUGONSTART=3; to attach to VS automatically.

Testing

msbuild_debug

Notes

Currently the tool looks for parent VS because we in vstest we run from a playground project that has parent VS. If it cannot find it, it looks for the first VS (by process startup time). You can provide VS PID, or process that is a child of VS, but that is too manual, and a better way to figure out the right process to attach is needed. E.g. one that has MSBuild.sln opened.

@nohwnd
Copy link
Member Author

nohwnd commented Mar 27, 2024

draft because I don't like the "link" to shared code file, or that there is no usefule strategy to find the right VS (but maybe having 10 VS instances is just my way of working). And the variable names are not great etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant