Visual Studio and Post-mortem debugging

93 Views Asked by At

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.

1

There are 1 best solutions below

0
Dylan On

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