Troubleshooting Exceptions: System.StackOverflowException
A StackOverflowException exception is thrown when the execution stack overflows by having too many nested method calls.
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.