user3754515
user3754515

Reputation: 13

Debug .Net and C++ app

I got two apps, one is .Net and other one is C++. The C++ app launches the .Net(wpf) app from within. I need to debug the .net app when the c++ app launches it.

So I did the following changes:
1. I mentioned c++ exe in" Start External program" in debug properties of the .net app.
2. Also checked Enable Native Debugging option. Now when i start .Net app then it launches the c++ app but it does not break in .Net app when it should because the breakpoint are disable due to the reason " symbols are not loaded".

Can you please help with it?
Saurabh

Upvotes: 0

Views: 65

Answers (1)

Hans Passant
Hans Passant

Reputation: 942348

This is expected, the debugger does not automatically debug a started child process. Workarounds:

  • Use Tools + Attach to Process to attach to the running WPF program
  • If debugging the startup of the WPF program is important then temporarily add a Debugger.Break() call in the App class constructor.
  • If modifying the WPF program is not practical then use the Image File Execution Options registry key to automatically launch a debugger whenever the WPF program is started. Check this post for details.
  • If the C++ code only passes command line arguments but does not otherwise interop with the WPF program then you can debug just the WPF app, use Project + Properties, Debug tab to set those command line options.
  • If it is not critical that the WPF app gets started by the C++ app, but just needs to be running, then you can configure the Solution settings and ask for both programs to be started. Right-click it, Startup Project, select the "Multiple" radio button.

Upvotes: 2

Related Questions