From d80188167a165b9f7bbdfe11d2e8e3839ccc406b Mon Sep 17 00:00:00 2001 From: Christian <6939810+chkr1011@users.noreply.github.com> Date: Wed, 1 May 2024 20:08:25 +0200 Subject: [PATCH] Restore support for null in _AddServer_ method in ASP.NET integration (#1981) * Upgrade ASP test project to dotnet8. * Fix broken null support for _AddMqttServer_ method. * Fix wrong code style * Downgrade to dotnet7.0 * Expose certificate selection in MQTTnet options * Revert "Expose certificate selection in MQTTnet options" This reverts commit f7d098a119665d14070502f4b9a87264a0cb6f14. * Update release notes --- .editorconfig | 3 +-- .github/workflows/ReleaseNotes.md | 3 ++- Source/MQTTnet.AspTestApp/MQTTnet.AspTestApp.csproj | 2 +- Source/MQTTnet.AspnetCore/ServiceCollectionExtensions.cs | 9 +++------ 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.editorconfig b/.editorconfig index c4b05393..da3f0a4d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -40,7 +40,6 @@ dotnet_style_qualification_for_method = false:suggestion dotnet_style_qualification_for_property = false:suggestion # ReSharper properties -resharper_autodetect_indent_settings = true resharper_default_private_modifier = implicit resharper_place_accessorholder_attribute_on_same_line = false resharper_use_indent_from_vs = false @@ -61,7 +60,7 @@ resharper_web_config_wrong_module_highlighting = warning [*] charset = utf-8 end_of_line = crlf -trim_trailing_whitespace = false +trim_trailing_whitespace = true insert_final_newline = false indent_style = space indent_size = 4 diff --git a/.github/workflows/ReleaseNotes.md b/.github/workflows/ReleaseNotes.md index b1e9464a..239b39cf 100644 --- a/.github/workflows/ReleaseNotes.md +++ b/.github/workflows/ReleaseNotes.md @@ -1,6 +1,7 @@ * [Core] Optimized packet serialization of PUBACK and PUBREC packets for protocol version 5.0.0 (#1939, thanks to @Y-Sindo). * [Core] The package inspector is now fully async (#1941). * [Client] Added a dedicated exception when the client is not connected (#1954, thanks to @marcpiulachs). -* [Server] The server will no longer send _NoMatchingSubscribers_ when the actual subscription was non success (#1965, BREAKING CHANGE!). +* [Server] The server will no longer send _NoMatchingSubscribers_ when the actual subscription was non success (#1965, BREAKING CHANGE!). +* [Server] Fixed broken support for _null_ in _AddServer_ method in ASP.NET integration (#1981). * [ManagedClient] Added a new event (SubscriptionsChangedAsync) which is fired when a subscription or unsubscription was made (#1894, thanks to @pdufrene). * [TopicTemplate] Added new extension which provides a template engine for topics (#1932, thanks to @simonthum). diff --git a/Source/MQTTnet.AspTestApp/MQTTnet.AspTestApp.csproj b/Source/MQTTnet.AspTestApp/MQTTnet.AspTestApp.csproj index e7fb5432..4bcabdd7 100644 --- a/Source/MQTTnet.AspTestApp/MQTTnet.AspTestApp.csproj +++ b/Source/MQTTnet.AspTestApp/MQTTnet.AspTestApp.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 enable enable false diff --git a/Source/MQTTnet.AspnetCore/ServiceCollectionExtensions.cs b/Source/MQTTnet.AspnetCore/ServiceCollectionExtensions.cs index 1186baeb..562ccd3c 100644 --- a/Source/MQTTnet.AspnetCore/ServiceCollectionExtensions.cs +++ b/Source/MQTTnet.AspnetCore/ServiceCollectionExtensions.cs @@ -40,13 +40,10 @@ namespace MQTTnet.AspNetCore throw new ArgumentNullException(nameof(services)); } - if (configure == null) - { - throw new ArgumentNullException(nameof(configure)); - } - var serverOptionsBuilder = new MqttServerOptionsBuilder(); - configure.Invoke(serverOptionsBuilder); + + configure?.Invoke(serverOptionsBuilder); + var options = serverOptionsBuilder.Build(); return AddHostedMqttServer(services, options);