[System.Security.SecurityCritical] // auto-generated_required public static GCHandle FromIntPtr(IntPtr value) { if (value == IntPtr.Zero) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_HandleIsNotInitialized")); } Contract.EndContractBlock(); IntPtr handle = value; #if MDA_SUPPORTED if (s_probeIsActive) { // Make sure this cookie matches up with a GCHandle we've passed out a cookie for. handle = s_cookieTable.GetHandle(value); if (IntPtr.Zero == handle) { // Fire an MDA if we were unable to retrieve the GCHandle. Mda.FireInvalidGCHandleCookieProbe(value); return(new GCHandle(IntPtr.Zero)); } } #endif return(new GCHandle(handle)); }
[System.Security.SecuritySafeCritical] // auto-generated static GCHandle() { s_probeIsActive = Mda.IsInvalidGCHandleCookieProbeEnabled(); if (s_probeIsActive) { s_cookieTable = new GCHandleCookieTable(); } }
public IMda CreateMda(int nodeId) { ValidateSettings(); var mda = new Mda(nodeId.ToString(), _timerService); Nodes.Add(mda); return(mda); }
internal static void SafeHandleRelease(SafeHandle pHandle) { if (pHandle == null) { throw new ArgumentNullException(Environment.GetResourceString("ArgumentNull_SafeHandle")); } try { pHandle.DangerousRelease(); } catch (Exception exception) { Mda.ReportErrorSafeHandleRelease(exception); } }
public static GCHandle FromIntPtr(IntPtr value) { if (value == IntPtr.Zero) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_HandleIsNotInitialized")); } IntPtr intPtr = value; if (GCHandle.s_probeIsActive) { intPtr = GCHandle.s_cookieTable.GetHandle(value); if (IntPtr.Zero == intPtr) { Mda.FireInvalidGCHandleCookieProbe(value); return(new GCHandle(IntPtr.Zero)); } } return(new GCHandle(intPtr)); }
public static GCHandle FromIntPtr(IntPtr value) { ValidateHandle(value); #if MDA_SUPPORTED IntPtr handle = value; if (s_probeIsActive) { // Make sure this cookie matches up with a GCHandle we've passed out a cookie for. handle = s_cookieTable.GetHandle(value); if (IntPtr.Zero == handle) { // Fire an MDA if we were unable to retrieve the GCHandle. Mda.FireInvalidGCHandleCookieProbe(value); return(new GCHandle(IntPtr.Zero)); } return(new GCHandle(handle)); } #endif return(new GCHandle(value)); }