public void CancelActivity(System.Workflow.ComponentModel.Activity activity)
 {
     if (this.currentActivity == null)
     {
         throw new ObjectDisposedException("ActivityExecutionContext");
     }
     if (activity == null)
     {
         throw new ArgumentNullException("activity");
     }
     if (!this.allowSignalsOnCurrentActivity && ((this.currentActivity.WorkflowCoreRuntime.CurrentActivity.ExecutionStatus == ActivityExecutionStatus.Initialized) || (this.currentActivity.WorkflowCoreRuntime.CurrentActivity.ExecutionStatus == ActivityExecutionStatus.Closed)))
     {
         throw new InvalidOperationException(SR.GetString("Error_InvalidStateToExecuteChild"));
     }
     if (!this.IsValidChild(activity, false))
     {
         throw new ArgumentException(SR.GetString("AEC_InvalidActivity"), "activity");
     }
     if (activity.ExecutionStatus != ActivityExecutionStatus.Executing)
     {
         throw new InvalidOperationException(SR.GetString("Error_InvalidCancelingState"));
     }
     try
     {
         activity.SetStatus(ActivityExecutionStatus.Canceling, false);
     }
     finally
     {
         this.currentActivity.WorkflowCoreRuntime.ScheduleItem(new ActivityExecutorOperation(activity, ActivityOperationType.Cancel, this.ContextId), IsInAtomicTransaction(activity), false, false);
     }
 }
 internal void CompensateActivity(System.Workflow.ComponentModel.Activity activity)
 {
     if (this.currentActivity == null)
     {
         throw new ObjectDisposedException("ActivityExecutionContext");
     }
     if (activity == null)
     {
         throw new ArgumentNullException("activity");
     }
     if (!this.IsValidNestedChild(activity))
     {
         throw new ArgumentException(SR.GetString("AEC_InvalidNestedActivity"), "activity");
     }
     if (activity.ExecutionStatus != ActivityExecutionStatus.Closed)
     {
         throw new InvalidOperationException(SR.GetString("Error_InvalidCompensatingState"));
     }
     try
     {
         activity.SetStatus(ActivityExecutionStatus.Compensating, false);
     }
     finally
     {
         this.currentActivity.WorkflowCoreRuntime.ScheduleItem(new ActivityExecutorOperation(activity, ActivityOperationType.Compensate, this.ContextId), IsInAtomicTransaction(activity), false, false);
     }
 }