private async Task SendAsync(Message message, CancellationToken ct) { TaskUtilities.AssertIsOnBackgroundThread(); _log.Request(message.ToString(), _rLoopDepth); try { await _transport.SendAsync(message, ct); } catch (MessageTransportException ex) when(ct.IsCancellationRequested) { // Network errors during cancellation are expected, but should not be exposed to clients. throw new OperationCanceledException(new OperationCanceledException().Message, ex); } catch (MessageTransportException ex) { throw new RHostDisconnectedException(ex.Message, ex); } }