Start debugging in C # launch project in native-only mode

I have a MSVC2013 solution with C # (managed) and C ++ (native) projects. One C # project is defined as a launch project . I want to start this project with debugging, which is usually achieved in devenv just by pressing F5.

However, I want to run the debugger in native mode only (i.e. there is no controlled debugging ). I can’t achieve this behavior by changing the settings of a C # project: it only has the option “Enable custom code debugging”, which allows you to enable or disable built-in debugging. The only standard way I know is to run the application without debugging, and then join the process using only native debugging.

Is there a way to automate this process? Ideally, a single button press should be sufficient to start self-debugging. Perhaps some expansion may simplify this task.


PS I encountered an unpleasant error in debugging in mixed mode, which completely debugs debugging in my case. This error in itself is not the topic of the question, it just explains why self-debugging with the C # launch project can be useful (and it is personally useful to me personally).

+4
c ++ debugging c # visual-studio
source share
1 answer

It’s not entirely clear why you cannot just use Project> Properties> Debug tab> tick "Enable native code debugging". If you use VS2012 and above, beware that you need to disable the new managed debugging engine, it is no longer compatible with C ++ / CLI code. Use Tools> Options> Debug> General> Use Compatible Compatibility Mode.

But you can achieve what you want, just select one of the native code projects as your launch project. Right-click> Install as Startup Project. And you have to choose start exe, right click> Properties> Debug> Command, change it to C # executable. Breakpoints become active (solid red) as soon as the C # code loads your DLL.

+5
source share

All Articles