Ullan
Ullan

Reputation: 1341

How to debug C# process

I want to debug two process,(ProcessA.exe and ProcessB.exe)

In the usual scenario, while starting the ProcessA will start ProcessB. ProcessA is a cross platform exe. ProcessB is C# application.(Visual Studio 2010 Professional).

I did the following for debugging ProcessB (C#)

  1. Started ProcessA from C:\Program Files\Test by clicking the exe.
  2. ProcessB through Visual Studio 2010 from C:\MyProjects. Attached ProcessA.

In Visual Studio 2010 Attach to Process window:,

Attach to: as "Managed(v4.) code).

I put the break point in C# code. But the break point is never getting executed also ProcessB call is not getting executed without debug also( ie, started all processes from different locations)

Upvotes: 1

Views: 457

Answers (3)

Preston McCormick
Preston McCormick

Reputation: 751

The Microsoft Child Process Debugging Power Tool handles this scenario beautifully. It works with Visual Studio 2013 on up.

This blog post covers some options that must be set, mainly "if you are debugging .NET code, you must choose to enable mixed mode debugging", but I recommend reading through the whole post.

Upvotes: 2

Sofian Hnaide
Sofian Hnaide

Reputation: 2364

You should attach to Process B and not Process A

You can try the following:

  1. Start ProcessA.exe
  2. VS-> Attach to process Window -> attach to ProcessB.exe

If you need to debug Process A, this should be done with a seperate VS instance with native debugging.

Upvotes: 0

ChrisLively
ChrisLively

Reputation: 88092

If A normally starts B then it seems like you should let A start B then attach visual studio to the B process after it has begun.

Upvotes: 1

Related Questions