I have a WPF Application after it is loading (some WCF services) and I am running a child process (Gui less Windows Application). Both projects are in my solution.
I wish to debug both of them. I know I can debug two projects if I set both of with action = start in the solution properties under "Multiple startup projects".
But this is not the case since the WPF app is starting the child process after X time. And I cannot "Attach to process" since I want to catch the main method of the child process.
Is there a solution?
What I did so far was to disable the CreateNewProcess()
method, place a breakpoint where it should occur, and manually debug the project, and then continue the WPF app from that breakpoint, using two visual studios.
Using the toolOnce you install the power tool from the Visual Studio Gallery, a new menu item will appear on the "Debug" menu under the "Other Debug Targets" sub-menu. When you open the settings page, you'll see a checkbox to enable child process debugging.
In Visual Studio, from the Tools menu, choose Launch Under Debugger. In the Launch Under Debugger dialog box, enter the path to the executable file. You can also enter arguments and a working directory. Click Launch.
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.
IntelliTrace always records events that happen in the Visual Studio debugger. For example, starting your application is a debugger event. Other debugger events are stopping events, which cause your application to break execution.
Use the debugger settings Registry key under
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
as described in this blog post to make the child process automatically break on startup. Then, when prompted, choose the Visual Studio instance you're using to debug the parent process.
You could try installing the following extension from the Visual Studio team: Introducing the Child Process Debugging Power Tool. It is available on the Gallery for Visual Studio 2013 and above.
It allows automatically attaching child processes to the current debugger, so in your case, the child process started by the WPF app would be attached to the debugger upon launch, and you could therefore easily intercept the main method of the child process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With