简体   繁体   English

Twitterizer2 1.2.4 Streaming API 异常 - 反序列化时意外结束 object

[英]Twitterizer2 1.2.4 Streaming API exception - Unexpected end when deserializing object

Any help would be appreciated.任何帮助,将不胜感激。 I'm getting an exception thrown during deserialization inside JSON.Net:我在 JSON.Net 中的反序列化过程中抛出异常:

Unexpected end when deserializing object. Line 216, position 2.反序列化 object 时意外结束。第 216 行,position 2.

My calling code: var asyncResult = s.StartPublicStream(streamErrorCallback, statusCreatedCallback, statusDeletedCallback, eventCallback, rawJsonCallback);我的调用代码: var asyncResult = s.StartPublicStream(streamErrorCallback, statusCreatedCallback, statusDeletedCallback, eventCallback, rawJsonCallback);

Setting a breakpoint in my rawJsonCallback handler shows (what appears to be) valid JSON coming back from the API.在我的 rawJsonCallback 处理程序中设置断点显示(看起来是)有效的 JSON 从 API 返回。

Added the source for Twitterizer2 and JSON.Net, looks like Twitterizer.Streaming.TwitterStream.ParseMessage(string) is failing here near line 520添加了 Twitterizer2 和 JSON.Net 的源代码,看起来 Twitterizer.Streaming.TwitterStream.ParseMessage(string) 在第 520 行附近失败了

var user = obj.SelectToken("user", false);
    if (user != null)
        {
            if (statusCreatedCallback != null && user.HasValues)
            {
                statusCreatedCallback(JsonConvert.DeserializeObject<TwitterStatus>(ConvertJTokenToString(obj)));

            }
            return;
        }

On the call to DeserializeObject().在调用 DeserializeObject() 时。

Newtonsoft.Json.Serliazation.JsonSerializerInternalReader.PopulateObject() fails because the reader.TokenType == None. Newtonsoft.Json.Serliazation.JsonSerializerInternalReader.PopulateObject() 失败,因为 reader.TokenType == None。

I suspect there is a discrepancy between the contract type/values and the object coming back from the API, but I'm not sure how to test further.我怀疑合同类型/值与从 API 返回的 object 之间存在差异,但我不确定如何进一步测试。 Wasn't able to get the Json.Net source to compile so I can't step through it.无法获得 Json.Net 源代码进行编译,所以我无法逐步完成它。

The problem is that Twitterizer 2.4 is using NewtonSoft.Json v4.08, which breaks it.问题是 Twitterizer 2.4 使用的是 NewtonSoft.Json v4.08,这会破坏它。 Install Newtonsoft.Json v4.03, and you'll be fine.安装Newtonsoft.Json v4.03,就可以了。

Maybe this could solve your issue.也许这可以解决您的问题。 I had a simillar one when I wanted to use the twitterize with JSON.NET 4.5当我想使用 JSON.NET 4.5 的 twitterize 时,我有一个类似的

I follow the steps that someone mentioned on github and then I've compiled the whole source code with the new json lib and voilá;)我按照某人在github上提到的步骤进行操作,然后我用新的 json 库编译了整个源代码,瞧瞧;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM