45.7. Mixed-Mode Debugging

The final thing to discuss before we close out the section on debugging is mixed-mode debugging. A mixed-mode application is any application that combines managed code (Visual Basic, C#, Managed C++, and so on) with native code (typically C++). Debugging a mixed-mode application is generally no different from debugging a pure managed-code application; however, you must first configure the application to support native code debugging. Figure 45-15, in the previous section, shows the unmanaged code debugger enabled along with the SQL Server debugger.

There are a couple of limitations with mixed-mode debugging that you should be aware of. First, it is only available on Windows 2000 or higher operating systems. Also, when debugging a mixed-mode application, you may find that some operations such as stepping through code run very slowly. This can be improved by unchecking the option to "Enable and other implicit function calls" in the Debugger option page.

Because native call stacks and managed call stacks are different, the debugger cannot always provide a single complete call stack for mixed code. Though fairly rare, it is possible that there will be some discrepancies in the call stack. You can find more information on this in the MSDN library.

Get Professional Visual Studio® 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.