コード例 #1
0
 public void RaiseException(Exception e, System.Workflow.ComponentModel.Activity activity, string responsibleActivity)
 {
     using (this.SetCurrentActivity(activity))
     {
         using (ActivityExecutionContext context = new ActivityExecutionContext(activity, true))
         {
             context.FaultActivity(e);
         }
     }
 }
コード例 #2
0
 public void RaiseException(Exception e, Activity activity, string responsibleActivity)
 {
     // No tracking needed
     using (SetCurrentActivity(activity))
     {
         using (ActivityExecutionContext executionContext = new ActivityExecutionContext(activity, true))
         {
             executionContext.FaultActivity(e);
         }
     }
 }
コード例 #3
0
        internal void ExceptionOccured(Exception exp, Activity currentActivity, string originalActivityId)
        {
            Debug.Assert(exp != null, "null exp");
            Debug.Assert(currentActivity != null, "null currentActivity");
            // exception tracking work
            //
            if (this.ThrownException != exp)
            {
                // first time exception
                this.ThrownException = exp;
                this.activityThrowingException = currentActivity.QualifiedName;
                originalActivityId = currentActivity.QualifiedName;
            }
            else
            {
                // rethrown exception
                originalActivityId = this.activityThrowingException;
            }
            Guid contextGuid = ((ActivityExecutionContextInfo)ContextActivityUtils.ContextActivity(currentActivity).GetValue(Activity.ActivityExecutionContextInfoProperty)).ContextGuid;
            Guid parentContextGuid = Guid.Empty;
            if (null != currentActivity.Parent)
                parentContextGuid = ((ActivityExecutionContextInfo)ContextActivityUtils.ContextActivity(currentActivity.Parent).GetValue(Activity.ActivityExecutionContextInfoProperty)).ContextGuid;
            this.FireExceptionOccured(exp, currentActivity.QualifiedName, originalActivityId, contextGuid, parentContextGuid);

            // notify the activity.
            //
            using (new ServiceEnvironment(currentActivity))
            {
                using (SetCurrentActivity(currentActivity))
                {
                    using (ActivityExecutionContext executionContext = new ActivityExecutionContext(currentActivity, true))
                        executionContext.FaultActivity(exp);
                }
            }

            // transaction and batching clean-up on the activity that handles the exception
            this.RollbackTransaction(exp, currentActivity);
            if ((currentActivity is TransactionScopeActivity) || (exp is PersistenceException))
                this.BatchCollection.RollbackBatch(currentActivity);
        }
 internal void ExceptionOccured(Exception exp, Activity currentActivity, string originalActivityId)
 {
     if (this.ThrownException != exp)
     {
         this.ThrownException = exp;
         this.activityThrowingException = currentActivity.QualifiedName;
         originalActivityId = currentActivity.QualifiedName;
     }
     else
     {
         originalActivityId = this.activityThrowingException;
     }
     Guid contextGuid = ((ActivityExecutionContextInfo) ContextActivityUtils.ContextActivity(currentActivity).GetValue(Activity.ActivityExecutionContextInfoProperty)).ContextGuid;
     Guid empty = Guid.Empty;
     if (currentActivity.Parent != null)
     {
         empty = ((ActivityExecutionContextInfo) ContextActivityUtils.ContextActivity(currentActivity.Parent).GetValue(Activity.ActivityExecutionContextInfoProperty)).ContextGuid;
     }
     this.FireExceptionOccured(exp, currentActivity.QualifiedName, originalActivityId, contextGuid, empty);
     using (new ServiceEnvironment(currentActivity))
     {
         using (this.SetCurrentActivity(currentActivity))
         {
             using (ActivityExecutionContext context = new ActivityExecutionContext(currentActivity, true))
             {
                 context.FaultActivity(exp);
             }
         }
     }
     this.RollbackTransaction(exp, currentActivity);
     if ((currentActivity is TransactionScopeActivity) || (exp is PersistenceException))
     {
         this.BatchCollection.RollbackBatch(currentActivity);
     }
 }
コード例 #5
0
 public void RaiseException(Exception e, Activity activity, string responsibleActivity)
 {
     // No tracking needed
     using (SetCurrentActivity(activity))
     {
         using (ActivityExecutionContext executionContext = new ActivityExecutionContext(activity, true))
         {
             executionContext.FaultActivity(e);
         }
     }
 }