internal Action GetCompletionAction(Task taskForTracing, ref AsyncMethodBuilderCore.MoveNextRunner runnerToInitialize) { Debugger.NotifyOfCrossThreadDependency(); ExecutionContext context = ExecutionContext.FastCapture(); AsyncMethodBuilderCore.MoveNextRunner moveNextRunner; Action continuation; if (context != null && context.IsPreAllocatedDefault) { Action action = this.m_defaultContextAction; if (action != null) { return(action); } moveNextRunner = new AsyncMethodBuilderCore.MoveNextRunner(context, this.m_stateMachine); continuation = new Action(moveNextRunner.Run); this.m_defaultContextAction = taskForTracing == null ? continuation : (continuation = this.OutputAsyncCausalityEvents(taskForTracing, continuation)); } else { moveNextRunner = new AsyncMethodBuilderCore.MoveNextRunner(context, this.m_stateMachine); continuation = new Action(moveNextRunner.Run); if (taskForTracing != null) { continuation = this.OutputAsyncCausalityEvents(taskForTracing, continuation); } } if (this.m_stateMachine == null) { runnerToInitialize = moveNextRunner; } return(continuation); }
// Token: 0x06005D19 RID: 23833 RVA: 0x001466DC File Offset: 0x001448DC internal static Action TryGetStateMachineForDebugger(Action action) { object target = action.Target; AsyncMethodBuilderCore.MoveNextRunner moveNextRunner = target as AsyncMethodBuilderCore.MoveNextRunner; if (moveNextRunner != null) { return(new Action(moveNextRunner.m_stateMachine.MoveNext)); } AsyncMethodBuilderCore.ContinuationWrapper continuationWrapper = target as AsyncMethodBuilderCore.ContinuationWrapper; if (continuationWrapper != null) { return(AsyncMethodBuilderCore.TryGetStateMachineForDebugger(continuationWrapper.m_continuation)); } return(action); }
internal Action GetCompletionAction <TMethodBuilder, TStateMachine>(ref TMethodBuilder builder, ref TStateMachine stateMachine) where TMethodBuilder : IAsyncMethodBuilder where TStateMachine : IAsyncStateMachine { ExecutionContextLightup context = ExecutionContextLightup.Instance.Capture(); AsyncMethodBuilderCore.MoveNextRunner moveNextRunner = new AsyncMethodBuilderCore.MoveNextRunner(context); Action result = new Action(moveNextRunner.Run); if (m_stateMachine == null) { builder.PreBoxInitialization(); m_stateMachine = stateMachine; m_stateMachine.SetStateMachine(m_stateMachine); } moveNextRunner.m_stateMachine = m_stateMachine; return(result); }
// Token: 0x06005D16 RID: 23830 RVA: 0x001465B8 File Offset: 0x001447B8 internal void PostBoxInitialization(IAsyncStateMachine stateMachine, AsyncMethodBuilderCore.MoveNextRunner runner, Task builtTask) { if (builtTask != null) { if (AsyncCausalityTracer.LoggingOn) { AsyncCausalityTracer.TraceOperationCreation(CausalityTraceLevel.Required, builtTask.Id, "Async: " + stateMachine.GetType().Name, 0UL); } if (Task.s_asyncDebuggingEnabled) { Task.AddToActiveTasks(builtTask); } } this.m_stateMachine = stateMachine; this.m_stateMachine.SetStateMachine(this.m_stateMachine); runner.m_stateMachine = this.m_stateMachine; }
public void AwaitOnCompleted <TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine { try { AsyncMethodBuilderCore.MoveNextRunner runner = null; Action completionAction = this.m_coreState.GetCompletionAction(AsyncCausalityTracer.LoggingOn ? this.Task : null, ref runner); if (this.m_coreState.m_stateMachine == null) { Task <TResult> task = this.Task; this.m_coreState.PostBoxInitialization(stateMachine, runner, task); } awaiter.OnCompleted(completionAction); } catch (Exception exception) { AsyncMethodBuilderCore.ThrowAsync(exception, null); } }
public void AwaitUnsafeOnCompleted <TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine { try { AsyncMethodBuilderCore.MoveNextRunner runnerToInitialize = (AsyncMethodBuilderCore.MoveNextRunner)null; Action completionAction = this.m_coreState.GetCompletionAction(AsyncCausalityTracer.LoggingOn ? (System.Threading.Tasks.Task) this.Task : (System.Threading.Tasks.Task)null, ref runnerToInitialize); if (this.m_coreState.m_stateMachine == null) { System.Threading.Tasks.Task <TResult> task = this.Task; this.m_coreState.PostBoxInitialization((IAsyncStateMachine)stateMachine, runnerToInitialize, (System.Threading.Tasks.Task)task); } awaiter.UnsafeOnCompleted(completionAction); } catch (Exception ex) { // ISSUE: variable of the null type __Null local = null; AsyncMethodBuilderCore.ThrowAsync(ex, (SynchronizationContext)local); } }
public void AwaitOnCompleted <TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine { try { AsyncMethodBuilderCore.MoveNextRunner runner = null; Action completionAction = this.m_coreState.GetCompletionAction(AsyncCausalityTracer.LoggingOn ? this.Task : null, ref runner); if (this.m_coreState.m_stateMachine == null) { if (AsyncCausalityTracer.LoggingOn) { AsyncCausalityTracer.TraceOperationCreation(CausalityTraceLevel.Required, this.Task.Id, "Async: " + stateMachine.GetType().Name, 0UL); } this.m_coreState.PostBoxInitialization(stateMachine, runner, null); } awaiter.OnCompleted(completionAction); } catch (Exception exception) { AsyncMethodBuilderCore.ThrowAsync(exception, null); } }
public void AwaitUnsafeOnCompleted <TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine { try { AsyncMethodBuilderCore.MoveNextRunner runnerToInitialize = (AsyncMethodBuilderCore.MoveNextRunner)null; Action completionAction = this.m_coreState.GetCompletionAction(AsyncCausalityTracer.LoggingOn ? this.Task : (Task)null, ref runnerToInitialize); if (this.m_coreState.m_stateMachine == null) { if (AsyncCausalityTracer.LoggingOn) { AsyncCausalityTracer.TraceOperationCreation(CausalityTraceLevel.Required, this.Task.Id, "Async: " + stateMachine.GetType().Name, 0UL); } this.m_coreState.PostBoxInitialization((IAsyncStateMachine)stateMachine, runnerToInitialize, (Task)null); } awaiter.UnsafeOnCompleted(completionAction); } catch (Exception ex) { // ISSUE: variable of the null type __Null local = null; AsyncMethodBuilderCore.ThrowAsync(ex, (SynchronizationContext)local); } }