public Task Start(CancellationTokenSource source) { _log.Information($"Starting {Name.ToLowerInvariant()}..."); _source = source; Task = Task.Factory.StartNew( async() => { try { _log.Information($"{Name} started."); if (!await _worker.Run(_source.Token)) { _source.Cancel(); } } catch (OperationCanceledException) { _log.Information($"{Name} aborted."); } catch (Exception ex) { _log.Error($"{Name}: {ex.Message} ({ex.GetType().FullName})"); _source.Cancel(); } finally { _log.Information($"{Name} stopped."); } }, TaskCreationOptions.LongRunning); return(Task); }