public void Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, System.Activities.ActivityInstance propagatedFrom)
        {
            base.EnsureCallback(faultCallbackType, faultCallbackParameters);
            FaultCallback callback = (FaultCallback)base.Callback;

            callback(faultContext, propagatedException, propagatedFrom);
        }
Ejemplo n.º 2
0
        public void Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
        {
            EnsureCallback(faultCallbackType, faultCallbackParameters);
            FaultCallback faultCallback = (FaultCallback)this.Callback;

            faultCallback(faultContext, propagatedException, propagatedFrom);
        }
 public static FaultBookmark CreateFaultBookmark(FaultCallback onFaulted, System.Activities.ActivityInstance owningInstance)
 {
     if (onFaulted != null)
     {
         return(new FaultBookmark(new FaultCallbackWrapper(onFaulted, owningInstance)));
     }
     return(null);
 }
 private void OnBodyComplete(NativeActivityContext context, System.Activities.ActivityInstance completedInstance)
 {
     if ((completedInstance.State == ActivityInstanceState.Canceled) || (context.IsCancellationRequested && (completedInstance.State == ActivityInstanceState.Faulted)))
     {
         this.suppressCancel.Set(context, true);
         context.MarkCanceled();
         if (this.CancellationHandler != null)
         {
             FaultCallback onFaulted = new FaultCallback(this.OnExceptionFromCancelHandler);
             context.ScheduleActivity(this.CancellationHandler, onFaulted);
         }
     }
 }
 private void OnBodyComplete(NativeActivityContext context, System.Activities.ActivityInstance completedInstance)
 {
     if ((completedInstance.State == ActivityInstanceState.Canceled) || (context.IsCancellationRequested && (completedInstance.State == ActivityInstanceState.Faulted)))
     {
         this.suppressCancel.Set(context, true);
         context.MarkCanceled();
         if (this.CancellationHandler != null)
         {
             FaultCallback onFaulted = new FaultCallback(this.OnExceptionFromCancelHandler);
             context.ScheduleActivity(this.CancellationHandler, onFaulted);
         }
     }
 }
Ejemplo n.º 6
0
 internal override void ScheduleAction(NativeActivityContext context, Exception exception, CompletionCallback completionCallback, FaultCallback faultCallback)
 {
     context.ScheduleAction <TException>(this.Action, (TException)exception, completionCallback, faultCallback);
 }
Ejemplo n.º 7
0
 public ActivityInstance ScheduleAction(ActivityAction activityAction, CompletionCallback onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }
 public FaultCallbackWrapper(FaultCallback callback, ActivityInstance owningInstance)
     : base(callback, owningInstance)
 {
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Schedules the <see cref="ActivityAction{Exception}"/>.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="exception"></param>
 /// <param name="attempts"></param>
 /// <param name="completionCallback"></param>
 /// <param name="faultCallback"></param>
 internal abstract void ScheduleAction(NativeActivityContext context, Exception exception, int attempts, CompletionCallback completionCallback, FaultCallback faultCallback);
Ejemplo n.º 10
0
 public ActivityInstance ScheduleAction <T1, T2> (ActivityAction <T1, T2> activityAction, T1 argument1, T2 argument2, CompletionCallback onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 11
0
 internal abstract void ScheduleAction(NativeActivityContext context, Exception exception, CompletionCallback completionCallback, FaultCallback faultCallback);
Ejemplo n.º 12
0
 public ActivityInstance ScheduleAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> (ActivityAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> activityAction, T1 argument1, T2 argument2, T3 argument3, T4 argument4, T5 argument5, T6 argument6, T7 argument7, T8 argument8, T9 argument9, T10 argument10, T11 argument11, T12 argument12, CompletionCallback onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }
 // Token: 0x0600164F RID: 5711 RVA: 0x00027158 File Offset: 0x00026158
 public void ScheduleActivity(WorkflowElement element, CompletionCallback completionCallback, FaultCallback faultCallback)
 {
     if (element != null)
     {
         ActivityExecutionContext activityExecutionContext = new ActivityExecutionContext(this.instance, element);
         this.completionCallback = completionCallback;
         this.faultCallback      = faultCallback;
         ActivityExecutionContext activityExecutionContext2 = activityExecutionContext;
         activityExecutionContext2.StatusChanged = (StatusChangedHandler)Delegate.Combine(activityExecutionContext2.StatusChanged, new StatusChangedHandler(this.OnDependencyStatusChanged));
         ActivityExecutionContext activityExecutionContext3 = activityExecutionContext;
         activityExecutionContext3.Faulted = (FaultCallback)Delegate.Combine(activityExecutionContext3.Faulted, new FaultCallback(this.OnDependencyFaulted));
         if (!this.children.Contains(element))
         {
             this.children.Add(element);
         }
         this.scheduled.Add(activityExecutionContext);
         this.instance.ScheduleItem(activityExecutionContext);
     }
 }
Ejemplo n.º 14
0
 public ActivityInstance ScheduleFunc <T1, T2, TResult> (ActivityFunc <T1, T2, TResult> activityFunc, T1 argument1, T2 argument2, CompletionCallback onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 15
0
 public ActivityInstance ScheduleFunc <T1, T2, T3, T4, T5, T6, T7, TResult> (ActivityFunc <T1, T2, T3, T4, T5, T6, T7, TResult> activityFunc, T1 argument1, T2 argument2, T3 argument3, T4 argument4, T5 argument5, T6 argument6, T7 argument7, CompletionCallback onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 16
0
 public ActivityInstance ScheduleDelegate(ActivityDelegate activityDelegate, IDictionary <string, Object> inputParameters, DelegateCompletionCallback onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 17
0
 public ActivityInstance ScheduleActivity <TResult> (Activity <TResult> activity, CompletionCallback <TResult> onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 18
0
 public ActivityInstance ScheduleActivity(Activity activity, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 19
0
 public FaultCallbackWrapper(FaultCallback callback, ActivityInstance owningInstance)
     : base(callback, owningInstance)
 {
 }
Ejemplo n.º 20
0
        private static async Task <TResult> WithFuncAsyncCore <TTuple, TResult>(TaskFuncFactory <TTuple, TResult> factory, Action <TransientOperationOptions> setup) where TTuple : Template
        {
            var options = setup.ConfigureOptions();

            if (!options.EnableRecovery)
            {
                return(await factory.ExecuteMethodAsync().ContinueWithSuppressedContext());
            }
            DateTime         timestamp        = DateTime.UtcNow;
            TimeSpan         latency          = TimeSpan.Zero;
            TimeSpan         totalWaitTime    = TimeSpan.Zero;
            TimeSpan         lastWaitTime     = TimeSpan.Zero;
            bool             isTransientFault = false;
            bool             throwExceptions;
            List <Exception> aggregatedExceptions = new List <Exception>();
            TResult          result = default(TResult);

            for (int attempts = 0; ;)
            {
                bool     exceptionThrown = false;
                TimeSpan waitTime        = options.RetryStrategy(attempts);
                try
                {
                    if (latency > options.MaximumAllowedLatency)
                    {
                        throw new LatencyException(string.Format(CultureInfo.InvariantCulture, "The latency of the operation exceeded the allowed maximum value of {0} seconds. Actual latency was: {1} seconds.", options.MaximumAllowedLatency.TotalSeconds, latency.TotalSeconds));
                    }
                    return(await factory.ExecuteMethodAsync().ContinueWithSuppressedContext());
                }
                catch (Exception ex)
                {
                    try
                    {
                        lock (aggregatedExceptions) { aggregatedExceptions.Insert(0, ex); }
                        isTransientFault = options.DetectionStrategy(ex);
                        if (attempts >= options.RetryAttempts)
                        {
                            throw;
                        }
                        if (!isTransientFault)
                        {
                            throw;
                        }
                        lastWaitTime  = waitTime;
                        totalWaitTime = totalWaitTime.Add(waitTime);
                        attempts++;
                        await Task.Delay(waitTime).ContinueWithSuppressedContext();

                        latency = DateTime.UtcNow.Subtract(timestamp).Subtract(totalWaitTime);
                    }
                    catch (Exception)
                    {
                        throwExceptions = true;
                        exceptionThrown = true;
                        if (isTransientFault)
                        {
                            var evidence = new TransientFaultEvidence(attempts, lastWaitTime, totalWaitTime, latency, new MethodDescriptor(factory.DelegateInfo).ToString());
                            aggregatedExceptions.InsertTransientFaultException(evidence);
                            FaultCallback?.Invoke(evidence);
                        }
                        break;
                    }
                }
                finally
                {
                    if (exceptionThrown)
                    {
                        IDisposable disposable = result as IDisposable;
                        disposable?.Dispose();
                    }
                }
            }
            if (throwExceptions)
            {
                throw new AggregateException(aggregatedExceptions);
            }
            return(result);
        }
Ejemplo n.º 21
0
 public ActivityInstance ScheduleFunc <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> (ActivityFunc <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> activityFunc, T1 argument1, T2 argument2, T3 argument3, T4 argument4, T5 argument5, T6 argument6, T7 argument7, T8 argument8, T9 argument9, T10 argument10, T11 argument11, T12 argument12, T13 argument13, T14 argument14, T15 argument15, T16 argument16, CompletionCallback onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 22
0
 public ActivityInstance ScheduleAction <T1, T2, T3, T4, T5, T6> (ActivityAction <T1, T2, T3, T4, T5, T6> activityAction, T1 argument1, T2 argument2, T3 argument3, T4 argument4, T5 argument5, T6 argument6, CompletionCallback onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }