Beispiel #1
0
            private async ValueTask ExecuteAsync(CancellationToken cancellationToken)
            {
                try
                {
                    using (_context.Track(this))
                    {
                        foreach (Func <ValueTask> task in _tasks)
                        {
                            if (cancellationToken.IsCancellationRequested)
                            {
                                return;
                            }

                            try
                            {
                                await task.Invoke().ConfigureAwait(false);
                            }
                            catch (Exception ex)
                            {
                                _context.ReportError(this, ex);
                            }
                        }
                    }
                }
                finally
                {
                    IsCanceled = cancellationToken.IsCancellationRequested;
                    _context.Completed();
                }
            }
Beispiel #2
0
 private async ValueTask ExecuteAsync()
 {
     try
     {
         using (_context.Track(this))
         {
             foreach (Func <ValueTask> task in _tasks)
             {
                 try
                 {
                     await task.Invoke().ConfigureAwait(false);
                 }
                 catch (Exception ex)
                 {
                     _context.ReportError(this, ex);
                 }
             }
         }
     }
     finally
     {
         _context.Completed();
     }
 }