我正在使用最新版本的TweetSharp加载用户的个人资料。
首先,我使用ListFollowerIdsFor
方法加载所有用户关注者。
之后,我将所有ID划分为最多100个ID的列表。
var ids = newUsersIds.Skip(i * 100).Take(100).Distinct().ToList(); var users = service.ListUserProfilesFor(new ListUserProfilesForOptions { UserId = ids });
And sometimes I get StackoverflowException
on this line.Last two lines in call stack:
The thread '<No Name>' (0x17a0) has exited with code 0 (0x0).
A first chance exception of type 'System.Net.WebException' occurred in System.dll
递归
TweetSharp.dll!TweetSharp.JsonSerializer.DeserializeContent(string content, System.Type type) Line 168 + 0x1b bytes C#
TweetSharp.dll!TweetSharp.JsonSerializer.DeserializeSingle(string content, System.Type type) Line 223 + 0x11 bytes C#
TweetSharp.dll!TweetSharp.JsonSerializer.DeserializeJson(string content, System.Type type) Line 41 + 0xe bytes C#
我该如何预防?
最佳答案
问题出在处理HTTP 500错误“ Twitter over Capacity”。在这种情况下,Tweetsharp尝试序列化html页面。