You cannot catch a StackOverflowException unless it is specified by user code. (more details)
- In the visual studio, from the Debug menu, select "New Breakpoint> Function Break ..."
- In the Function box of the New Breakpoint dialog box, enter
StackOverflowException.StackOverflowException - Run the program in the debugger. Once you get a stack overflow, the debugger stops at the breakpoint.
source share