Пример #1
0
 protected async override Task ExecuteAsync(
     CancellationToken cancellationToken)
 {
     while (!cancellationToken.IsCancellationRequested)
     {
         try
         {
             var   t = _taskQueue.DequeueAsync(cancellationToken);
             await t;
         }
         catch (Exception ex)
         {
         }
     }
 }
        protected override Task ExecuteAsync(
            CancellationToken cancellationToken)
        {
            _backgroundRunner = Task.Run(async() =>
            {
                while (!cancellationToken.IsCancellationRequested)
                {
                    try
                    {
                        var t = _taskQueue.DequeueAsync(cancellationToken);
                        await t;
                    }
                    catch (Exception ex)
                    {
                    }
                }
            });

            return(Task.CompletedTask);
        }
        protected override Task ExecuteAsync(
            CancellationToken cancellationToken)
        {
            _backgroundRunner = Task.Run(async() =>
            {
                while (!cancellationToken.IsCancellationRequested)
                {
                    try
                    {
                        var t = _taskQueue.DequeueAsync(cancellationToken);
                        await t;
                    }
#pragma warning disable CS0168 // Variable is declared but never used
                    catch (Exception ex)
#pragma warning restore CS0168 // Variable is declared but never used
                    {
                    }
                }
            });

            return(Task.CompletedTask);
        }