10

Using SignalR (v2.0.2) I'm getting this exception:

Value cannot be null.
Parameter name: o
   at Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull(Object value, String parameterName)
   at Newtonsoft.Json.Linq.JToken.FromObjectInternal(Object o, JsonSerializer jsonSerializer)
   at Newtonsoft.Json.Linq.JToken.FromObject(Object o, JsonSerializer jsonSerializer)
   at Microsoft.AspNet.SignalR.Client.Hubs.HubProxy.Invoke[T](String method, Object[] args)

I'm calling the HubProxy with reflection, and I am passing in some null arguments that are triggering this error (aka, some items in the Object[] args are null). However, passing null for an argument to a method is a perfectly legitimate thing to do. Is this a bug in SignalR in that it is trying to serialize null parameters or is it a bug in Json.NET (v6.0.1) in that it shouldn't attempt to serialize a null object?

5
  • Check this stackoverflow.com/questions/2988724/… Commented Mar 21, 2014 at 18:57
  • @tweellt, I checked that link. It seems to be a similar error but not a similar situation. Commented Mar 21, 2014 at 19:06
  • Did you try another serialization? javascriptserializer? Commented May 12, 2014 at 12:12
  • @Dmitry, I have not attempted to replace the serialization in SignalR with any other framework. I really like Json.NET and don't want to replace it. I use it numerous other places in my software. Commented May 12, 2014 at 15:20
  • Show as your code! :) Commented May 24, 2015 at 14:25

2 Answers 2

0

Turns out this is a known bug in SignalR that has been fixed and will be included in the upcoming 2.2.1 release. See their ticket here.

Sign up to request clarification or add additional context in comments.

3 Comments

As of October 2016 it appears that this is still an active argument. No fix is permanent yet.
Their latest release lists this as fixed: github.com/SignalR/SignalR/releases/tag/2.2.1.
Still happening in 2.4
0

You can try to override SignalR hubs invocation method, for example: customize Microsoft.AspNet.SignalR.AuthorizeAttribute like this:

public override bool AuthorizeHubMethodInvocation(IHubIncomingInvokerContext hubIncomingInvokerContext, bool appliesToMethod)
{

}

Then before invoke, you can check your request and make some processing if needed.

1 Comment

Please provide more details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.