瀏覽代碼

Fix for Nullable.

release/3.x.x
PMExtra 4 年之前
父節點
當前提交
c83bec6e81
共有 2 個檔案被更改,包括 4 行新增1 行删除
  1. +3
    -1
      Source/MQTTnet/Extensions/UserPropertyExtension.cs
  2. +1
    -0
      Source/MQTTnet/MQTTnet.csproj

+ 3
- 1
Source/MQTTnet/Extensions/UserPropertyExtension.cs 查看文件

@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Linq;

namespace MQTTnet.Extensions
@@ -17,9 +18,10 @@ namespace MQTTnet.Extensions
{
var value = GetUserProperty(message, propertyName, comparisonType);

var typeDescriptor = TypeDescriptor.GetConverter(typeof(T));
try
{
return (T) Convert.ChangeType(value, typeof(T));
return (T) typeDescriptor.ConvertFromString(value);
}
catch (Exception ex)
{


+ 1
- 0
Source/MQTTnet/MQTTnet.csproj 查看文件

@@ -42,6 +42,7 @@
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)'=='netstandard1.3'">
<PackageReference Include="System.ComponentModel.TypeConverter" Version="4.3.0" />
<PackageReference Include="System.Net.Security" Version="4.3.2" />
<PackageReference Include="System.Net.WebSockets" Version="4.3.0" />
<PackageReference Include="System.Net.WebSockets.Client" Version="4.3.2" />


Loading…
取消
儲存