diff --git a/Build/MQTTnet.nuspec b/Build/MQTTnet.nuspec
index 02f199f..2be9d25 100644
--- a/Build/MQTTnet.nuspec
+++ b/Build/MQTTnet.nuspec
@@ -27,7 +27,7 @@
-
+
diff --git a/Frameworks/MQTTnet.NetStandard/Client/MqttClient.cs b/Frameworks/MQTTnet.NetStandard/Client/MqttClient.cs
index 8384bca..edf9b44 100644
--- a/Frameworks/MQTTnet.NetStandard/Client/MqttClient.cs
+++ b/Frameworks/MQTTnet.NetStandard/Client/MqttClient.cs
@@ -507,12 +507,20 @@ namespace MQTTnet.Client
private void StartReceivingPackets(CancellationToken cancellationToken)
{
- _packetReceiverTask = Task.Run(() => ReceivePacketsAsync(cancellationToken), cancellationToken);
+ _packetReceiverTask = Task.Factory.StartNew(
+ () => ReceivePacketsAsync(cancellationToken),
+ cancellationToken,
+ TaskCreationOptions.LongRunning,
+ TaskScheduler.Current);
}
private void StartSendingKeepAliveMessages(CancellationToken cancellationToken)
{
- _keepAliveMessageSenderTask = Task.Run(() => SendKeepAliveMessagesAsync(cancellationToken), cancellationToken);
+ _keepAliveMessageSenderTask = Task.Factory.StartNew(
+ () => SendKeepAliveMessagesAsync(cancellationToken),
+ cancellationToken,
+ TaskCreationOptions.LongRunning,
+ TaskScheduler.Current);
}
private void StartProcessReceivedPacketAsync(MqttBasePacket packet, CancellationToken cancellationToken)
diff --git a/Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.cs b/Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.cs
index f1d349d..0404de3 100644
--- a/Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.cs
+++ b/Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.cs
@@ -43,7 +43,11 @@ namespace MQTTnet.Implementations
_defaultEndpointSocket.Bind(new IPEndPoint(options.DefaultEndpointOptions.BoundIPAddress, options.GetDefaultEndpointPort()));
_defaultEndpointSocket.Listen(options.ConnectionBacklog);
- Task.Run(() => AcceptDefaultEndpointConnectionsAsync(_cancellationTokenSource.Token), _cancellationTokenSource.Token);
+ Task.Factory.StartNew(
+ () => AcceptDefaultEndpointConnectionsAsync(_cancellationTokenSource.Token),
+ _cancellationTokenSource.Token,
+ TaskCreationOptions.LongRunning,
+ TaskScheduler.Current);
}
if (options.TlsEndpointOptions.IsEnabled)
@@ -63,7 +67,11 @@ namespace MQTTnet.Implementations
_tlsEndpointSocket.Bind(new IPEndPoint(options.TlsEndpointOptions.BoundIPAddress, options.GetTlsEndpointPort()));
_tlsEndpointSocket.Listen(options.ConnectionBacklog);
- Task.Run(() => AcceptTlsEndpointConnectionsAsync(_cancellationTokenSource.Token), _cancellationTokenSource.Token);
+ Task.Factory.StartNew(
+ () => AcceptTlsEndpointConnectionsAsync(_cancellationTokenSource.Token),
+ _cancellationTokenSource.Token,
+ TaskCreationOptions.LongRunning,
+ TaskScheduler.Current);
}
return Task.FromResult(0);
diff --git a/Frameworks/MQTTnet.NetStandard/MQTTnet.Netstandard.csproj b/Frameworks/MQTTnet.NetStandard/MQTTnet.Netstandard.csproj
index cb154c2..fc1e41a 100644
--- a/Frameworks/MQTTnet.NetStandard/MQTTnet.Netstandard.csproj
+++ b/Frameworks/MQTTnet.NetStandard/MQTTnet.Netstandard.csproj
@@ -6,7 +6,6 @@
MQTTnet
MQTTnet
False
- Full
0.0.0.0
0.0.0.0
0.0.0.0
@@ -19,7 +18,7 @@
false
-
+
false
UAP,Version=v10.0
UAP
@@ -32,6 +31,10 @@
$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets
+
+ Full
+
+
@@ -43,17 +46,17 @@
-
+
-
+
-
+
diff --git a/Tests/MQTTnet.TestApp.AspNetCore2/MQTTnet.TestApp.AspNetCore2.csproj b/Tests/MQTTnet.TestApp.AspNetCore2/MQTTnet.TestApp.AspNetCore2.csproj
index 0a720ca..29b7253 100644
--- a/Tests/MQTTnet.TestApp.AspNetCore2/MQTTnet.TestApp.AspNetCore2.csproj
+++ b/Tests/MQTTnet.TestApp.AspNetCore2/MQTTnet.TestApp.AspNetCore2.csproj
@@ -2,7 +2,7 @@
netcoreapp2.0
- 2.3
+ Latest