Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio: debug multiple projects at the same time?

Is it possible to debug multiple projects at the same time in Visual Studio?

I know you can select multiple startup projects from the solutions properties, but how are the breakpoints handled?

If two projects use the same class (two different instances of it), and I am stopped with a breakpoint in it, will it only block one program or both? How can I know which executable is hitting the breakpoint? I'm a bit confused.

like image 491
Fred Avatar asked Jan 14 '16 09:01

Fred


People also ask

How do I run two projects at the same time in Visual Studio?

Visual Studio allows you to specify how more than one project is run when you press F5 (Start with Debugging), or Ctrl+F5 (Start without debugging), or use the toolbar button to launch your application.

How do I run multiple solutions in Visual Studio?

Setting multiple startup projects in Visual Studio is easy… 1 – Right click the solution and select 'Set Startup Projects…'. 2 – Select 'Multiple startup projects' and choose two or more projects. 3 – Press run and Visual Studio will open them in your selected browser.

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.


1 Answers

Yes, it is possible. You can set multiple startup projects in your solution (right-click solution, go to Set Startup Projects, choose Multiple startup projects), and specify the action for each project contained in the solution (None, Start, Start without debugging). If you have multiple projects set to Start, the debugger will attach to each one as it launches.

When you hit a breakpoint, you can see which process you're in using the Debug Location toolbar (you may have to show it; some profiles hide this by default). It will show which process you're currently looking at, which thread you're on, and which stack frame you're in:

Debug Location toolbar

I believe the default behavior is that when one process breaks, the debugger will break all of them. This way you can check the state of any attached process when you hit a single breakpoint.

like image 195
Jimmy Avatar answered Oct 16 '22 10:10

Jimmy