GC::EndNoGCRegion Method ()
Ends the no GC region latency mode.
Assembly: mscorlib (in mscorlib.dll)
| Exception | Condition |
|---|---|
| InvalidOperationException | The garbage collector is not in no GC region latency mode. See the Remarks section for more information. -or- The no GC region latency mode was ended previously because a garbage collection was induced. -or- A memory allocation exceeded the amount specified in the call to the TryStartNoGCRegion method. |
The EndNoGCRegion method throws an InvalidOperationException if the garbage collector is not in no GC region latency mode. This occurs under any of the following conditions:
The TryStartNoGCRegion method was not called previously.
The call to the TryStartNoGCRegion method returned false.
The call to the TryStartNoGCRegion method threw an exception.
You can prevent an exception for any of these reasons by using code such as the following:
Available since 4.6