Esempio n. 1
0
            public async Task RunAsync()
            {
                TaskCompletionSource <object> tcs = this._taskCompletionSource;

                try
                {
                    await this._work().ConfigureAwait(false);

                    if (null != tcs)
                    {
                        tcs.TrySetResult((object)string.Empty);
                    }
                }
                catch (OperationCanceledException ex)
                {
                    if (null != tcs)
                    {
                        tcs.TrySetCanceled();
                    }
                }
                catch (Exception ex)
                {
                    if (tcs == null || !tcs.TrySetException(ex))
                    {
                        Debug.WriteLine("AsyncFifoWorker.WorkHandle.RunAsync() work should not throw exceptions: " + ExceptionExtensions.ExtendedMessage(ex));
                    }
                    else
                    {
                        goto label_9;
                    }
                }
                label_9 :;
            }