I've come across exactly this problem in the last week. I strongly suspect that it is related to access tokens expiring or other errors: I've regularly seen this occur after my program has been active for 5 minutes (of polling every 20 seconds).
I've added some code to check whether the return value is null
, and just log a diagnostic message in that case, otherwise treating it the same way as an empty list. I have once seen it recover from this condition, but usually once it's started returning null
it just continues doing so. I suspect (but haven't checked the source code) that somewhere there's code which is catching an exception and just returning null
on any error (which is distinctly annoying, if it really is the cause).
This doesn't help you resolve the problem immediately of course - other than suggesting the same icky workaround I've used (treating null
as empty and logging) but it's at least an indication that this isn't anything you're doing wrong - unless I'm doing the same thing wrong :)
EDIT: I've now looked through the TweetSharp code, and it looks like the interaction between TweetSharp and Hammock effectively masks exceptions, which is a great pity. So a return value of null
doesn't necessarily indicate an access token issue - it's just "an error" :( It probably wouldn't be too hard to tweak the TweetSharp code base to throw exceptions appropriately instead... or it may be worth looking for an alternative API.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…