public static AsyncFlowControl SuppressFlow() { if (IsFlowSuppressed()) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotSupressFlowMultipleTimes")); } AsyncFlowControl afc = new AsyncFlowControl(); afc.Setup(); return afc; }
internal static AsyncFlowControl SuppressFlow(SecurityContextDisableFlow flags) { #if MOBILE throw new NotSupportedException (); #else if (IsFlowSuppressed(flags)) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotSupressFlowMultipleTimes")); } ExecutionContext ec = Thread.CurrentThread.GetMutableExecutionContext(); if (ec.SecurityContext == null) ec.SecurityContext = new SecurityContext(); AsyncFlowControl afc = new AsyncFlowControl(); afc.Setup(flags); return afc; #endif }
internal static AsyncFlowControl SuppressFlow(SecurityContextDisableFlow flags) { if (IsFlowSuppressed(flags)) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotSupressFlowMultipleTimes")); } if (Thread.CurrentThread.ExecutionContext.SecurityContext == null) Thread.CurrentThread.ExecutionContext.SecurityContext = new SecurityContext(); AsyncFlowControl afc = new AsyncFlowControl(); afc.Setup(flags); return afc; }