diff --git a/.github/workflows/ReleaseNotes.md b/.github/workflows/ReleaseNotes.md index f9abc621b..5ee275ee8 100644 --- a/.github/workflows/ReleaseNotes.md +++ b/.github/workflows/ReleaseNotes.md @@ -1,4 +1,5 @@ * [Client] Fixed _PlatformNotSupportedException_ when using Blazor (#1755, thanks to @Nickztar). +* [Client] Fixed wrong logging of obsolete feature when connection was not successful (#1801, thanks to @ramonsmits). * [Client] Fixed _NullReferenceException_ when performing several actions when not connected (#1800, thanks to @ramonsmits). * [Server] Fixed _NullReferenceException_ in retained messages management (#1762, thanks to @logicaloud). * [Server] Exposed new option which allows disabling packet fragmentation (#1753). diff --git a/Source/MQTTnet/Client/MqttClient.cs b/Source/MQTTnet/Client/MqttClient.cs index 938348e85..8556484e2 100644 --- a/Source/MQTTnet/Client/MqttClient.cs +++ b/Source/MQTTnet/Client/MqttClient.cs @@ -465,11 +465,10 @@ async Task Authenticate(IMqttChannelAdapter channelAdap // did send a proper ACK packet with a non success response. if (options.ThrowOnNonSuccessfulConnectResponse) { - _logger.Warning( - "Client will now throw an _MqttConnectingFailedException_. This is obsolete and will be removed in the future. Consider setting _ThrowOnNonSuccessfulResponseFromServer=False_ in client options."); - if (result.ResultCode != MqttClientConnectResultCode.Success) { + _logger.Warning( + "Client will now throw an _MqttConnectingFailedException_. This is obsolete and will be removed in the future. Consider setting _ThrowOnNonSuccessfulResponseFromServer=False_ in client options."); throw new MqttConnectingFailedException($"Connecting with MQTT server failed ({result.ResultCode}).", null, result); } } @@ -1060,4 +1059,4 @@ async Task TrySendKeepAliveMessages(CancellationToken cancellationToken) } } } -} \ No newline at end of file +}