Created On:  08 July 2011


If you have a Visual Studio Solution which contains managed code projects that call into native code projects you cannot simply step through the managed program into the native program using the debugger.

You can step through the managed code but when the call is made into the native program, the native program will run at full speed and control will return to the debugger as soon as it returns from the native program.

How is it then possible to debug the called native portion of the application?


The following instructions are for customers who have Visual Studio Solutions containing managed projects with Console, Winforms, WebForms and WPF front ends that call programs in native projects that are packaged in .dlls.

In order to debug the called native code it is necessary to do the following:

If you have a native program that you want to debug and it is NOT a web application you can:

1. Modify the start program under the debug tab of the native project so that it points to the starting managed code .EXE
2. Right click on the native project and make it the startup project.
3. Set a breakpoint in the native program.
4. Press F5 to run and the managed portion will run at full speed and the debugger will stop at the native breakpoint.

If it is a web application you can debug the native code as follows:

1. Insert a CALL “CBL_DEBUGBREAK” at the beginning of the code that you want to debug.
2. Start application by pressing Ctrl F5 start without debugging.
3. When the CALL CBL_DEBUGBREAK line is hit you will be prompted to start a debugging session.
4. Choose the Visual Studio instance that is running your application. 5. Native code will then be displayed for debugging.