Example #1
0
        static void Finally(AsyncResult result, Exception completionException)
        {
            WorkflowOperationContext thisPtr = (WorkflowOperationContext)result;

            thisPtr.EmitTransferFromInstanceId();

            if (completionException != null)
            {
                if (completionException is FaultException)
                {
                    thisPtr.TrackMethodFaulted();
                }
                else
                {
                    thisPtr.TrackMethodFailed();
                }
            }
            else
            {
                thisPtr.TrackMethodCompleted(thisPtr.operationReturnValue);
            }
            thisPtr.ProcessFinalizationTraces();
            // will be a no-op if we were never added to the instance
            thisPtr.workflowInstance.ReleaseContext(thisPtr);
            thisPtr.RemovePendingOperation();
        }
        private static void Finally(AsyncResult result, Exception completionException)
        {
            WorkflowOperationContext context = (WorkflowOperationContext)result;

            context.EmitTransferFromInstanceId();
            if (completionException != null)
            {
                if (completionException is FaultException)
                {
                    context.TrackMethodFaulted();
                }
                else
                {
                    context.TrackMethodFailed();
                }
            }
            else
            {
                context.TrackMethodCompleted(context.operationReturnValue);
            }
            context.ProcessFinalizationTraces();
            context.workflowInstance.ReleaseContext(context);
            context.RemovePendingOperation();
        }