async void TryAsyncReceive(CancellationToken token, IDisposable parallelOperation) { try { using (parallelOperation) using (var context = new TransactionContext()) { var transportMessage = await ReceiveTransportMessage(token, context); if (transportMessage == null) { context.Dispose(); // no need for another thread to rush in and discover that there is no message //parallelOperation.Dispose(); _backoffStrategy.WaitNoMessage(); return; } _backoffStrategy.Reset(); await ProcessMessage(context, transportMessage); } } catch (TaskCanceledException) { // it's fine - just a sign that we are shutting down } catch (OperationCanceledException) { // it's fine - just a sign that we are shutting down } catch (Exception exception) { _log.Error(exception, "Unhandled exception in thread pool worker"); } }