示例#1
0
        /// <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();
        }
示例#2
0
        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);
                }
            }
        }
示例#3
0
 public static void RemoveFromActiveTasks(Task task)
 {
     DebuggerSupport.RemoveFromActiveTasks(task);
 }