Xiwen
Xiwen

Reputation: 263

Debugging in multi-project under one solution in vs 2010

I have multiple projects in one solution. Project A (the starting project) starts Project B using Process.Start.

All the debugging methods work fine in project A, however after A starts B, not only do breakpoints not work, but also the output from calls to System.Diagnostics.Debug.WriteLine is not displayed.

Does anyone know how to debug in this situation?

Upvotes: 1

Views: 1594

Answers (4)

Noffls
Noffls

Reputation: 5427

You could add an call to System.Diagnostics.Debugger.Launch(); in the Main from Project B. So every time you start Project B it will ask you if you want to attach a Debugger.

Upvotes: 0

JaredPar
JaredPar

Reputation: 755317

In this scenario you have 2 processes running and you need to attach Visual Studio to both of them. Visual Studio supports attaching to multiple processes and getting it to do so is the same as attaching to a single process. Once the second process is launched do the following

  • Tools -> Attach to Process
  • Select the process
  • Hit Attach

Upvotes: 2

Beth Lang
Beth Lang

Reputation: 1905

You are debugging the process that Project A is working and because you are starting a second process for Project B you have not attached your debugger to that process. So you need to attach to the second process.

Upvotes: 1

Dave Hogan
Dave Hogan

Reputation: 3221

The new process which is created at runtime will not have the debugger attached hence breakpoints and debug.writeline won't work.

You might be able to select "Debug" menu then "Attach to process" from within Visual Studio once the new process is running.

Upvotes: 1

Related Questions