Esempio n. 1
0
 public static Exception AssertAndThrowFatal(string description)
 {
     Fx.Assert(description);
     throw Fx.Exception.AsError(new FatalException(description));
 }
Esempio n. 2
0
 public TransactionSignalScope(AsyncResult result, Transaction transaction)
 {
     this.parent           = result;
     this.transactionScope = Fx.CreateTransactionScope(transaction);
 }
Esempio n. 3
0
 public static Exception AssertAndThrow(string description)
 {
     Fx.Assert(description);
     throw Fx.Exception.AsError(new AssertionFailedException(description));
 }
Esempio n. 4
0
        protected bool TryComplete(bool didCompleteSynchronously, Exception exception)
        {
            bool flag;

            lock (this.ThisLock)
            {
                if (!this.isCompleted)
                {
                    this.exception   = exception;
                    this.isCompleted = true;
                    goto Label0;
                }
                else
                {
                    flag = false;
                }
            }
            return(flag);

Label0:
            this.completedSynchronously = didCompleteSynchronously;
            if (this.OnCompleting != null)
            {
                try
                {
                    this.OnCompleting(this, this.exception);
                }
                catch (Exception exception2)
                {
                    Exception exception1 = exception2;
                    if (Fx.IsFatal(exception1))
                    {
                        throw;
                    }
                    this.exception = exception1;
                }
            }
            if (!didCompleteSynchronously)
            {
                lock (this.ThisLock)
                {
                    if (this.manualResetEvent != null)
                    {
                        this.manualResetEvent.Set();
                    }
                }
            }
            if (this.callback != null)
            {
                try
                {
                    if (this.VirtualCallback == null)
                    {
                        this.callback(this);
                    }
                    else
                    {
                        this.VirtualCallback(this.callback, this);
                    }
                }
                catch (Exception exception4)
                {
                    Exception exception3 = exception4;
                    if (!Fx.IsFatal(exception3))
                    {
                        throw Fx.Exception.AsError(new CallbackException(SRCore.AsyncCallbackThrewException, exception3), null);
                    }
                    throw;
                }
            }
            return(true);
        }