Bewerken

Delen via


RuntimeHelpers.ProbeForSufficientStack Method

Definition

Caution

The Constrained Execution Region (CER) feature is not supported.

Probes for a certain amount of stack space to ensure that a stack overflow cannot happen within a subsequent block of code (assuming that your code uses only a finite and moderate amount of stack space). We recommend that you use a constrained execution region (CER) instead of this method.

public:
 static void ProbeForSufficientStack();
[System.Obsolete("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId="SYSLIB0004", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static void ProbeForSufficientStack ();
[System.Security.SecurityCritical]
public static void ProbeForSufficientStack ();
public static void ProbeForSufficientStack ();
[<System.Obsolete("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId="SYSLIB0004", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member ProbeForSufficientStack : unit -> unit
[<System.Security.SecurityCritical>]
static member ProbeForSufficientStack : unit -> unit
static member ProbeForSufficientStack : unit -> unit
Public Shared Sub ProbeForSufficientStack ()
Attributes

Remarks

This method is used by the constrained execution region (CER) infrastructure when running in hosts that are resilient to stack overflow such as Microsoft SQL Server and Microsoft Exchange Server. This method currently probes for 48 KB of stack space on the x86 platform, but the exact amount may change over time and may vary on other platforms.

This method is also used by compilers.

Instead of using the ProbeForSufficientStack method, you should use a standard CER. That is, if you are planning to use a moderate amount of stack space, call the RuntimeHelpers.PrepareConstrainedRegions method immediately before your try/finally or try/catch block. If you are calling a recursive method or plan to use a lot of stack space, you must use the RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup method.

Applies to