Ensures that the remaining stack space is large enough to execute the average .NET Framework function.
RuntimeHelpers.EnsureSufficientExecutionStack provides information about an artificially limited stack that preserves enough space for an exception to be raised and recovery action to be taken. The artificial stack limit is chosen by the common language runtime to ensure that enough space remains to throw an exception safely.
This method is useful in situations where stack overflow might occur as a result of unbounded recursion. It is intended for use in compiler services scenarios, although it can also be used safely in other development scenarios.
If the stack space is sufficient, the exception is not thrown, and most .NET Framework types and members can still be called.
This method is not part of the constrained execution region (CER) support, and should not be confused with the RuntimeHelpers.ProbeForSufficientStack method.