Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to attach two debugger to one process?

Is it possible to attach two debugger to one process ?

Recently, I had developed a Metro Style App in HTML5/CSS and that was calling a Window Runtime Component written in C#. What I wanted to do was attach two debugger to same process. One at JavaScript & another at C# code.

The Step I followed:

I opened two visual studio instances targeting same solution.

  • I put a breakpoint in JavaScript code and f5/run the application via VS instance 1.
  • But, when I tried to attach 2nd debugger in C# window runtime component via VS instance 2 it gives me a dialog saying "Debugger already attached to process".

I've seen a Window Runtime presentation in which the speaker did the same successfully. Kindly, help me out with this.

like image 787
Himanshu Avatar asked Sep 23 '12 17:09

Himanshu


People also ask

How do debuggers attach to processes?

You can attach the Visual Studio debugger to a running process on a local or remote computer. After the process is running, select Debug > Attach to Process or press Ctrl+Alt+p in Visual Studio, and use the Attach to Process dialog to attach the debugger to the process.

How do I add multiple processes in Visual Studio?

With the app running, select Debug > Attach to Process. In the Attach to Process dialog box, select the process from the Available Processes list, and then select Attach.

How do you attach code or debugger?

To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D. The Run and Debug view displays all information related to running and debugging and has a top bar with debugging commands and configuration settings.

How do I Debug multiple files in Visual Studio code?

To debug multiple services at the same timeOpen the folder corresponding to your first service in VS Code. In VS Code, select File > Add Folder to Workspace…, and pick the folder corresponding to your other service.


2 Answers

That's not possible.

See here:

For both managed-only and native-only debugging, you can only attach 1 debugger to a process.

Why?

The native debugger steals debug events from underneath the managed debugger. This confuses the managed-debugger and will cause it to crash. The native debugger has no way of coordinating with the managed-debugger here.

like image 186
N_A Avatar answered Sep 17 '22 22:09

N_A


You don't need 2 debuggers to do that. You can use the same debugger to debug both. Just make sure your solution contains both projects and just put your breakpoints where you need them

like image 44
George Avatar answered Sep 20 '22 22:09

George