I have a MSVC2013 solution with C# (managed) and C++ (native) projects. One C# project is set as startup project. I want to start this project with debugging, which is usually achieved in devenv by simply pressing F5.
However, I want to start debugger in native-only mode (i.e. no managed debugging). I cannot achieve this behavior by changing settings of C# project: it only has an option "Enable native code debugging", which allows to enable or disable native debugging. The only standard way I know is to start application without debugging, and then attach to process with only native debugging chosen.
Is there a way to automate this process? Ideally, pressing one button should be enough to start native-only debugging. Perhaps some extension could simplify this task.
P.S. I have bumped into a nasty bug in mixed mode debugging, which breaks debugging completely in my case. This bug itself is not the topic of the question, it just explains why native-only debugging with C# startup project may be useful (and is useful to me personally).
It is not very clear why you can't simply use Project > Properties > Debug tab > tick "Enable native code debugging". If you use VS2012 and up then do beware that you have to disable the new managed debugging engine, it is no longer compatible with C++/CLI code. Use Tools > Options > Debugging > General > tick "Use Managed Compatibility Mode".
But you can achieve what you want, simply select one of the native code projects as your startup project. Right-click > Set as Startup Project. And you must select the startup EXE, Right-click > Properties > Debugging > Command, change it to the C# executable. Breakpoints become active (colored solid red) as soon as the C# code loads your DLL.
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