public static void RestoreFlow() { Thread currentThread = Thread.CurrentThread; ExecutionContext executionContext = currentThread.ExecutionContext; if (executionContext == null || !executionContext.m_isFlowSuppressed) { throw new InvalidOperationException(SR.InvalidOperation_CannotRestoreUnsupressedFlow); } currentThread.ExecutionContext = executionContext.ShallowClone(isFlowSuppressed: false); }
public static void RestoreFlow() { Thread currentThread = Thread.CurrentThread; ExecutionContext executionContext = currentThread.ExecutionContext; if (executionContext == null || !executionContext.m_isFlowSuppressed) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotRestoreUnsupressedFlow")); } Contract.EndContractBlock(); currentThread.ExecutionContext = executionContext.ShallowClone(isFlowSuppressed: false); }
public static AsyncFlowControl SuppressFlow() { Thread currentThread = Thread.CurrentThread; ExecutionContext executionContext = currentThread.ExecutionContext ?? Default; if (executionContext.m_isFlowSuppressed) { throw new InvalidOperationException(SR.InvalidOperation_CannotSupressFlowMultipleTimes); } executionContext = executionContext.ShallowClone(isFlowSuppressed: true); var asyncFlowControl = new AsyncFlowControl(); currentThread.ExecutionContext = executionContext; asyncFlowControl.Initialize(currentThread); return(asyncFlowControl); }
public static AsyncFlowControl SuppressFlow() { Thread currentThread = Thread.CurrentThread; ExecutionContext executionContext = currentThread.ExecutionContext ?? Default; if (executionContext.m_isFlowSuppressed) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotSupressFlowMultipleTimes")); } Contract.EndContractBlock(); executionContext = executionContext.ShallowClone(isFlowSuppressed: true); var asyncFlowControl = new AsyncFlowControl(); currentThread.ExecutionContext = executionContext; asyncFlowControl.Initialize(currentThread); return(asyncFlowControl); }