Thoughts of a random geek

Friday, December 22, 2006

Mixed Mode debugging in Visual Studio 2005

So for the longest time I've been developing a C# application that calls C++ code through the C++ interop. One of the problems with this was the inability to debug C++ code. The call stack would just say "Native to Managed Transition". If an exception was thrown in C++ land, C# land would just say "Yeah, you got an exception. Where? How the hell should I know?"

Well, finally, I found the answer. Right-click on your project in the Solution Explorer, click on Properties, go to the Debug tab, and check "Enable unmanaged code debugging".

Bam! Now I can hit the breakpoints that I placed in my unmanaged code that gets called from my managed code. No more "the breakpoint will not currently be hit. No symbols have been loaded for this document"

No comments: