Showing posts with label Debugging. Show all posts
Showing posts with label Debugging. Show all posts

Friday, March 20, 2009

Finding a Stack Overflow

Today I had a little difficulty tracking down a Stack Overflow problem when debugging a Windows Mobile 5.0 project using the emulator. The Call Stack Window was blank, kinda difficult to find where in the code the problem occured.

Thankfully there's an easy solution! Open the Exceptions Window (shown below) and toggle on the appropriate exception types, in this case its Stack Overflow. Now the IDE stops at the source of the problem, with a full Call Stack Window, nice!


If you're still having problems breaking in the code when the Stack Overflow occurs, check on the Linker System settings page for the Stack Reserve Size and Stack Commit Size. Try setting both the Stack Reserve Size and Stack Commit Size to zero.

The combination of turning on the Stack Overflow Exception Type, and setting Stack Reserve Size to zero seemed to allow the debugger to stop with a full Call Stack Window, giving me more information about the source of the problem.

Friday, February 27, 2009

Debugger won't break in managed dll when running from unmanaged project

In the previously described scenario, where a native MFC C++ application calls a .NET assembly via a bridge dll, I ran into some debugging issues.

  1. The debugger doesn't stop at break points set in the bridge dll or the .NET assembly code.
  2. The debugger doesn't step into the bridge dll source code.

This problem is solved by setting Configuration Properties | Debugger Type to Mixed mode for each project.

Note: this is a different than setting "Mixed Platforms", which appears when you have a C++ project and a C# project in the same solution.