gpt4 book ai didi

c# - Twitterizer TwitterTimeline NewtonSoft.JSON.JsonSerializationException 问题

转载 作者:行者123 更新时间:2023-11-30 12:14:40 28 4
gpt4 key购买 nike

以下代码抛出 NewtonSoft.JSON.JsonSerializationException {“反序列化对象时出现意外标记:StartObject。第 1 行,位置 1884。”}

Twitterizer 版本:2.4.0.26532 NewtonSoft.Json = 4.0.7.0(使用 Visual Studio 中的 Nu-GET 插件安装)

有什么我遗漏或没有得到的东西吗?

   class Program
{
static void Main(string[] _args)
{
Logger.Write("Calling Twitter", Constants.TWITTER_AGREGATOR_LOG_CATEGORY);

UserTimelineOptions options = new UserTimelineOptions();
options.ScreenName = "as_tuce2";
TwitterResponse<TwitterStatusCollection> tweets = TwitterTimeline.UserTimeline(options); //throws exception


OAuthTokens tokens = new OAuthTokens();
tokens.AccessToken = // removed...
tokens.AccessTokenSecret = // removed...
tokens.ConsumerKey = // removed...
tokens.ConsumerSecret = // removed...

UserTimelineOptions userOptions = new UserTimelineOptions();
userOptions.IncludeRetweets = false;
userOptions.ScreenName = "as_tuce2";
userOptions.UseSSL = true;
userOptions.Count = 20;


TwitterResponse<TwitterUser> showUserResponse = TwitterUser.Show(tokens, "as_tuce2"); //ok
TwitterResponse<TwitterStatusCollection> timelineResponse = TwitterTimeline.UserTimeline(tokens); //throws exception


Console.ReadLine();
}
}

堆栈跟踪:

at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, String id) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 1238 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateAndPopulateObject(JsonReader reader, JsonObjectContract contract, String id) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 956 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 433 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 236 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueNonProperty(JsonReader reader, Type objectType, JsonContract contract, JsonConverter converter) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 221 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IWrappedCollection wrappedList, JsonReader reader, String reference, JsonArrayContract contract) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 794 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.<>c_DisplayClass1.<CreateAndPopulateList>b_0(IList l, Boolean isTemporaryListReference) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 744 at Newtonsoft.Json.Utilities.CollectionUtils.CreateAndPopulateList(Type listType, Action2 populateList) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Utilities\CollectionUtils.cs:line 233
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateAndPopulateList(JsonReader reader, String reference, JsonArrayContract contract) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 732
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String reference) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 495
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 238
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueNonProperty(JsonReader reader, Type objectType, JsonContract contract, JsonConverter converter) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 221
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line 117
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonSerializer.cs:line 421
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonSerializer.cs:line 413
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonConvert.cs:line 732
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonConvert.cs:line 694
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json\JsonConvert.cs:line 651
at Twitterizer.Core.SerializationHelper
1.Deserialize(Byte[] webResponseData, DeserializationHandler deserializationHandler) at Twitterizer.Core.TwitterCommand1.ExecuteCommand()
at Twitterizer.Core.CommandPerformer.PerformAction[T](ICommand
1 command) at Twitterizer.TwitterTimeline.UserTimeline(OAuthTokens tokens, UserTimelineOptions options) at Twitterizer.TwitterTimeline.UserTimeline(UserTimelineOptions options)

最佳答案

感谢您发帖。我将不得不看一下它并弄清楚新版本的 json.net 发生了什么变化。

为了后代,here is the forums topic你也在那里报告了错误。

关于c# - Twitterizer TwitterTimeline NewtonSoft.JSON.JsonSerializationException 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9026705/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com