Troubleshooting Exceptions: System.StackOverflowException
A StackOverflowException exception is thrown when the execution stack overflows by having too many nested method calls.
Associated Tips
- Make sure you do not have an infinite loop or infinite recursion.
Too many method calls is often indicative of a very deep or unbounded recursion.
Remarks
You cannot catch stack overflow exceptions, because the exception-handling code may require the stack. Instead, when a stack overflow occurs in a normal application, the Common Language Runtime (CLR) terminates the process.
An application that hosts the CLR can change the default behavior and specify that the CLR unload the application domain where the exception occurs, but lets the process continue. For more information, see ICLRPolicyManager Interface.
See Also
Tasks
How to: Use the Exception Assistant