mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-15 00:15:15 +08:00
* Return task with NULL result instead of NULL * move Task.FromResult call out of lock * Update ReleaseNotes.md --------- Co-authored-by: Christian <6939810+chkr1011@users.noreply.github.com>
This commit is contained in:
@@ -1 +1,2 @@
|
||||
* [Client] Fixed _PlatformNotSupportedException_ when using Blazor (#1755, thanks to @Nickztar).
|
||||
* [Client] Fixed _PlatformNotSupportedException_ when using Blazor (#1755, thanks to @Nickztar).
|
||||
* [Server] Fixed _NullReferenceException_ in retained messages management (#1762, thanks to @logicaloud).
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MQTTnet.Tests.Server
|
||||
{
|
||||
[TestClass]
|
||||
public sealed class MqttRetainedMessageManager_Tests
|
||||
{
|
||||
[TestMethod]
|
||||
public async Task MqttRetainedMessageManager_GetUndefinedTopic()
|
||||
{
|
||||
var logger = new Mockups.TestLogger();
|
||||
var eventContainer = new MQTTnet.Server.MqttServerEventContainer();
|
||||
var retainedMessagesManager = new MQTTnet.Server.MqttRetainedMessagesManager(eventContainer, logger);
|
||||
var task = retainedMessagesManager.GetMessage("undefined");
|
||||
Assert.IsNotNull(task, "Task should not be null");
|
||||
var result = await task;
|
||||
Assert.IsNull(result, "Null result expected");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,9 +134,9 @@ namespace MQTTnet.Server
|
||||
{
|
||||
return Task.FromResult(message);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return Task.FromResult<MqttApplicationMessage>(null);
|
||||
}
|
||||
|
||||
public async Task ClearMessages()
|
||||
|
||||
Reference in New Issue
Block a user