Skip to content

Instantly share code, notes, and snippets.

@richardkundl
Created November 26, 2013 10:49
Show Gist options
  • Save richardkundl/7656473 to your computer and use it in GitHub Desktop.
Save richardkundl/7656473 to your computer and use it in GitHub Desktop.
Ensures that the remaining stack space is large enough to execute the average .NET Framework function.
try
{
RuntimeHelpers.EnsureSufficientExecutionStack();
// call recursion
}
catch (InsufficientExecutionStackException)
{
// catch recursion stackoverflow exception
}
catch
{
// catch the regular exception
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment