“值不能为空"将空参数传递给SignalR客户端代理时 [英] "Value cannot be null" when passing null arguments to SignalR client-side proxy

查看:336
本文介绍了“值不能为空"将空参数传递给SignalR客户端代理时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用SignalR(v2.0.2)我遇到了这个异常:

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)

我正在通过反射调用HubProxy,并且传入了一些会触发此错误的空参数(aka,Object[] args中的某些项目为空).但是,将参数的null传递给方法是完全合法的事情.这是SignalR的一个错误,是它试图序列化空参数?还是Json.NET(v6.0.1)的一个错误,它不应尝试序列化空对象?

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?

推荐答案

原来,这是SignalR中的一个已知错误,已修复,将包含在即将发布的2.2.1版本中.在此处查看票证.

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.

这篇关于“值不能为空"将空参数传递给SignalR客户端代理时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆