0

I would like to know how vsjitdebugger.exe can cause a particular running instance of Visual Studio to be used to debug a process.

Background: currently vsjitdebugger.exe is set as the executable run whenever there is a "debug break" - i.e. in C# System.Diagnostics.Debugger.Launch();. Whenever this happens I see a dialog with a list of available debuggers - this includes all running instances of Visual Studio.

My question is how vsjitdebugger.exe activates a particular running instance of Visual Studio. Please note that I am particularly interested in existing running instances of VS and not in starting a new instance.

Jack J Jun
  • 5,633
  • 1
  • 9
  • 27
Adrian S
  • 514
  • 7
  • 16
  • Maybe the message is sent through a pipe. Or maybe it's a windows message. Or some COM/ActiveX sort of thing. Or even a TCPIP socket (not very likely though). What does it matter? – Dialecticus Jun 09 '21 at 09:27
  • @Dialecticus it matters because I want to replace `vsjitdebugger.exe` (in itself very easy to do) and come up with a non-interactive way of activating the right instance of Visual Studio under certain circumstances. – Adrian S Jun 09 '21 at 11:31
  • Maybe you could use Process Monitor (from SysInternals Suite) to figure it out. – Dialecticus Jun 09 '21 at 12:06

1 Answers1

0

Maybe you can attach the process to vs debugger through VS sdk.

public static void Attach(DTE dte)  
{  
    EnvDTE.Processes processes = dte.Debugger.LocalProcesses;  
    foreach(EnvDTE.Process proc in processes)  
        if(proc.Name.IndexOf("Target.exe") != -1)  
            proc.Attach();  
}

The document: Process Interface

Dylan
  • 504
  • 2
  • 5
  • 9