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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could use the
TryGetVSInstancemethod 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.