Skip to content

Commit 389427e

Browse files
Adam Gossmoozzyk
authored andcommitted
Fixed an issue (SignalR#1655) with null values failing to serialize due to an ArgumentNullException.
The code has been modified to use the orinal JToken.FromObject() method if the argument is not null, otherwise JValue.CreateNull() is used instead.
1 parent 80e519a commit 389427e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Microsoft.AspNet.SignalR.Client/Hubs/HubProxy.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
22

3+
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Linq;
35
using System;
46
using System.Collections.Generic;
57
using System.Diagnostics.CodeAnalysis;
6-
using System.Globalization;
78
using System.Threading.Tasks;
8-
using Microsoft.AspNet.SignalR.Client;
9-
using Newtonsoft.Json;
10-
using Newtonsoft.Json.Linq;
119

1210
namespace Microsoft.AspNet.SignalR.Client.Hubs
1311
{
@@ -97,7 +95,9 @@ public Task<TResult> Invoke<TResult, TProgress>(string method, Action<TProgress>
9795
var tokenifiedArguments = new JToken[args.Length];
9896
for (int i = 0; i < tokenifiedArguments.Length; i++)
9997
{
100-
tokenifiedArguments[i] = JToken.FromObject(args[i], JsonSerializer);
98+
tokenifiedArguments[i] = args[i] != null
99+
? JToken.FromObject(args[i], JsonSerializer)
100+
: JValue.CreateNull();
101101
}
102102

103103
var tcs = new TaskCompletionSource<TResult>();

0 commit comments

Comments
 (0)