2

Closed

ApplicationOnlyAuthorizer.Authorize()

description

Hi.

It seems this method will cause an application to hang if, for instance, the Consumer Key or Consumer Secret are invalid. Could we have an exception thrown, please?

Good work, by the way.
Closed Jul 12, 2013 at 4:14 AM by JoeMayo

comments

JoeMayo wrote Jun 30, 2013 at 1:04 AM

Sorry, I'm having trouble reproducing a hang scenario. I've tried setting a valid ConsumerKey /invalid ConsumerSecret and an invalid ConsumerKey/valid ConsumerSecret. In each case the code properly throws WebException with the expected 401 code.

@JoeMayo

spjohnson wrote Jul 2, 2013 at 4:14 PM

Yep agree, great work Joe.

I'm also getting this issue on the .NET 3.5 version, in addition to not having any connection exceptions thrown back up to the calling method (e.g. if attempting to connect offline) to the calling method.

Instead they are being treated as unhandled exceptions - At least with ApplicationOnlyAuthorizer.cs.

I may not be correct, though after having a quick debug it looks like there could be an issue with the BeginGetRequestStream/EndGetRequestStream code. Perhaps it is executing on a separate thread and without a callback method and try / catch statements it is getting treated as unhandled.

spjohnson wrote Jul 2, 2013 at 4:23 PM

Just a clarification on my earlier comment - exceptions thrown for connectivity reasons (e.g. cannot resolve api.twitter.com) will be unhandled -- even with try / catch statements around the auth.Authorize() call.

JoeMayo wrote Jul 12, 2013 at 4:14 AM

I just checked in a fix for this. It's available via downloadable source code until the next release.