Export (0) Print
Expand All

RuntimeHelpers.EnsureSufficientExecutionStack Method

Ensures that the remaining stack space is large enough to execute the average .NET Framework function.

Namespace:  System.Runtime.CompilerServices
Assembly:  mscorlib (in mscorlib.dll)

public static void EnsureSufficientExecutionStack()

ExceptionCondition
InsufficientExecutionStackException

The available stack space is insufficient to execute the average .NET Framework function.

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.

NoteNote

This method is not part of the constrained execution region (CER) support, and should not be confused with the RuntimeHelpers.ProbeForSufficientStack method.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft