Fortunately, there is a way to debug both types of code at the same time using two instances of Visual Studio:
- Load the project in a second instance of Visual Studio. Ignore warnings about IntelliSense files being already open, but prepare to wait a little while as VS will build a new copy of that database for this second instance.
- In this second instance, set the debugging mode to Native Only, Managed Only, or Mixed, depending on your needs. This is where you’ll be debugging C#/VB/C++ code, as in a WinRT component.
- Select the Debug -> Attach to Process… menu command. (You do this instead of running the app a second time.)
- Find and select the line for WWAHost.exe in the process list that has your app name in the title column.
- Above the list, check the Attach to value. If it says “Automatic: Script code”, press the Select… button and indicate Managed and Native instead. Close that dialog.
- Click the Attach button.
Then go set breakpoints in this second instance of VS where you want to step through managed/native code. While this still won’t allow you to step across the language boundaries in a single debugger, it will allow you to step through each code type in the different instances.
Thanks for Rob Paveza for this tip.