/// <summary>Completes the method builder successfully.</summary> public void SetResult() { Task taskIfDebuggingEnabled = this.GetTaskIfDebuggingEnabled(); if (taskIfDebuggingEnabled != null) { if (DebuggerSupport.LoggingOn) { DebuggerSupport.TraceOperationCompletion(CausalityTraceLevel.Required, taskIfDebuggingEnabled, AsyncStatus.Completed); } DebuggerSupport.RemoveFromActiveTasks(taskIfDebuggingEnabled); } NotifySynchronizationContextOfCompletion(); }
public void SetResult() { var task = m_task; if (task == null) { m_task = s_cachedCompleted; } else { if (DebuggerSupport.LoggingOn) { DebuggerSupport.TraceOperationCompletion(CausalityTraceLevel.Required, task, AsyncStatus.Completed); } DebuggerSupport.RemoveFromActiveTasks(task); if (!task.TrySetResult(default(VoidTaskResult))) { throw new InvalidOperationException(SR.TaskT_TransitionToFinal_AlreadyCompleted); } } }
public static void RemoveFromActiveTasks(Task task) { DebuggerSupport.RemoveFromActiveTasks(task); }