I know I can find if a process is being debugged via a call to Debugger.IsAttached in .NET, but I'd like to be able to get the PID of the Visual Studio that is the debugging the processes. Is this possible?
Task Manager can be opened in a number of ways, but the simplest is to select Ctrl+Alt+Delete, and then select Task Manager. In Windows, first click More details to expand the information displayed. From the Processes tab, select Details to see the process ID listed in the PID column. Click on any column name to sort.
The most commonly used way to look at variables is the DataTip. When stopped in the debugger hover the mouse cursor over the variable you want to look at. The DataTip will appear showing you the value of that variable.
One of the key features of Visual Studio Code is its great debugging support. VS Code's built-in debugger helps accelerate your edit, compile, and debug loop.
You could use the TryGetVSInstance
method outlined in this answer to get a hold of each instance of Visual Studio's EnvDTE COM Automation object. Once you have that, just iterate the DTE.Debugger.DebuggedProcesses collection and check if any of them are pointing to the same processID as the process you're interested in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With