Esempio n. 1
0
        public void Abort()
        {
            using (new WorkflowTraceTransfer(this.InstanceId))
            {
                while (true)
                {
                    WorkflowExecutor executor = _runtime.Load(this);
                    if (executor.IsInstanceValid)
                    {
                        if (executor.WorkflowStatus == WorkflowStatus.Created)
                        {
                            throw new InvalidOperationException(ExecutionStringManager.CannotAbortBeforeStart);
                        }

                        try
                        {
                            executor.Abort();
                            break;
                        }
                        catch (InvalidOperationException)
                        {
                            if (executor.IsInstanceValid)
                            {
                                throw;
                            }
                        }
                    }
                }
            }
        }