diff --git a/src/NATS.Client.Core/NatsConnection.cs b/src/NATS.Client.Core/NatsConnection.cs index 8156e5cd4..2c18b2078 100644 --- a/src/NATS.Client.Core/NatsConnection.cs +++ b/src/NATS.Client.Core/NatsConnection.cs @@ -756,15 +756,11 @@ private async void ReconnectLoop() // which in turn would crash the application. // (e.g. we've seen this with EventLog provider on Windows) } - - return; } - // the reconnect loop should never get here, since everything - // is either an early return or stays in the loop try { - _logger.LogError(NatsLogEvents.Connection, "Retry loop stopped and connection state is invalid [{ReconnectCount}]", reconnectCount); + _logger.LogDebug(NatsLogEvents.Connection, "Reconnect loop stopped [{ReconnectCount}]", reconnectCount); } catch { @@ -946,6 +942,10 @@ private async void StartPingTimer(CancellationToken cancellationToken) await periodicTimer.WaitForNextTickAsync(cancellationToken).ConfigureAwait(false); } } + catch (OperationCanceledException) + { + // Cancelling is part of a normal reconnect operation, so we don't need to log this + } catch (Exception e) { if (!IsDisposed)