I have blogged about how tricky it can be to catch StackOverflowExceptions even with a great tool like procdump there are a few parameters (C00000FD.STACK_OVERFLOW) to add that are not well documented. In addition to the problem of capture it is also challenging to get to the bottom/source of the call stack, this is because call stack checks are really expensive so by default Visual Studio (and WinDbg) limit the number of frames we normally display. Unfortunately for a StackOverflowException limiting the call frames is specifically problematic for this kind of situation.

In order to help with both the challenge of checking all the stack frames and the desire to see the bottom of the call stack the latest preview of Visual Studio 2019 (16.9 preview 3) has a really cool solution. It detects repeating frames and collapses those repeats and shows you the top and the bottom of the call stack, hopefully allowing you to view the most important information to diagnose the issue.

Stackoverflow collapsed stackframes

Share on Twitter Facebook

Comment Section