3

我正在使用最新版本的 TweetSharp 来加载用户的个人资料。首先,我使用ListFollowerIdsFor方法加载用户的所有关注者。之后,我将所有 id 划分为最多 100 个 id 的列表。

 
var ids = newUsersIds.Skip(i * 100).Take(100).Di​​stinct().ToList();
var users = service.ListUserProfilesFor(new ListUserProfilesForOptions { UserId = ids });

有时我会StackoverflowException搭上这条线。调用堆栈中的最后两行:

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#

我该如何预防?

4

1 回答 1

2

问题在于处理 HTTP 500 错误“Twitter over capacity”。Tweetsharp 尝试在这种情况下序列化 html 页面。

于 2013-03-11T03:39:08.497 回答