{
bool lockTaken = false;
- RuntimeHelpers.PrepareConstrainedRegions();
try
{
Monitor.Enter(this, ref lockTaken);
Interlocked.CompareExchange(ref s_methodInstantiationsLock!, new object(), null);
bool lockTaken = false;
- RuntimeHelpers.PrepareConstrainedRegions();
try
{
Monitor.Enter(s_methodInstantiationsLock, ref lockTaken);
internal void SetWaitObject(WaitHandle waitObject)
{
- // needed for DangerousAddRef
- RuntimeHelpers.PrepareConstrainedRegions();
-
m_internalWaitObject = waitObject;
if (waitObject != null)
{
)
{
bool result = false;
- // needed for DangerousRelease
- RuntimeHelpers.PrepareConstrainedRegions();
// lock(this) cannot be used reliably in Cer since thin lock could be
// promoted to syncblock and that is not a guaranteed operation
bool ret = false;
bool mustReleaseSafeHandle = false;
- RuntimeHelpers.PrepareConstrainedRegions();
try
{
osHandle.DangerousAddRef(ref mustReleaseSafeHandle);
using System.Globalization;
using System.IO;
using System.Net.Sockets;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
Debug.Assert(_thisLock != null, "'_thisLock' MUST NOT be NULL.");
Debug.Assert(SessionHandle != null, "'SessionHandle' MUST NOT be NULL.");
- if (thisLockTaken || sessionHandleLockTaken)
+ if (thisLockTaken)
{
- RuntimeHelpers.PrepareConstrainedRegions();
- try
- {
- }
- finally
- {
- if (thisLockTaken)
- {
- Monitor.Exit(_thisLock);
- thisLockTaken = false;
- }
+ Monitor.Exit(_thisLock);
+ thisLockTaken = false;
+ }
- if (sessionHandleLockTaken)
- {
- Monitor.Exit(SessionHandle);
- sessionHandleLockTaken = false;
- }
- }
+ if (sessionHandleLockTaken)
+ {
+ Monitor.Exit(SessionHandle);
+ sessionHandleLockTaken = false;
}
}
Debug.Assert(lockObject != null, "'lockObject' MUST NOT be NULL.");
if (lockTaken)
{
- RuntimeHelpers.PrepareConstrainedRegions();
- try
- {
- }
- finally
- {
- Monitor.Exit(lockObject);
- lockTaken = false;
- }
+ Monitor.Exit(lockObject);
+ lockTaken = false;
}
}
using System.Buffers;
using System.Diagnostics;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
unsafe
{
byte* pointer = null;
- RuntimeHelpers.PrepareConstrainedRegions();
try
{
buffer.AcquirePointer(ref pointer);
{
byte* pointer = null;
- RuntimeHelpers.PrepareConstrainedRegions();
try
{
_buffer.AcquirePointer(ref pointer);
{
byte* pointer = null;
- RuntimeHelpers.PrepareConstrainedRegions();
try
{
_buffer.AcquirePointer(ref pointer);
unsafe
{
byte* pointer = null;
- RuntimeHelpers.PrepareConstrainedRegions();
try
{
_buffer.AcquirePointer(ref pointer);
}
byte* pointer = null;
- RuntimeHelpers.PrepareConstrainedRegions();
try
{
_buffer.AcquirePointer(ref pointer);
unsafe
{
byte* pointer = null;
- RuntimeHelpers.PrepareConstrainedRegions();
try
{
_buffer.AcquirePointer(ref pointer);
===========================================================*/
using System.Threading;
-using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Diagnostics;
if (!needPageFile)
continue;
- // Attempt to grow the OS's page file. Note that we ignore
- // any allocation routines from the host intentionally.
- RuntimeHelpers.PrepareConstrainedRegions();
-
// This shouldn't overflow due to the if clauses above.
UIntPtr numBytes = new UIntPtr(segmentSize);
GrowPageFileIfNecessaryAndPossible(numBytes);
if (LastKnownFreeAddressSpace < 0)
CheckForFreeAddressSpace(segmentSize, true);
- RuntimeHelpers.PrepareConstrainedRegions();
-
AddMemoryFailPointReservation((long)size);
_mustSubtractReservation = true;
}
// within the GC heap.
if (_mustSubtractReservation)
{
- RuntimeHelpers.PrepareConstrainedRegions();
-
AddMemoryFailPointReservation(-((long)_reservedMemory));
_mustSubtractReservation = false;
}