Reputation: 21
An week ago I faced a problem with getting request token from TweetSharp library, every time it throws null exception. Previously it works, credentials are valid. The same problem with test from https://github.com/shugonta/tweetsharp Looks like again some problem with TweetSharp proxy.
var service = new TwitterService(_consumerKey, _consumerSecret);
var requestToken = service.GetRequestToken();
System.ArgumentNullException : Value cannot be null.
Parameter name: query
at System.Compat.Web.HttpUtility.ParseQueryString(String query, Encoding encoding) in D:\My Dropbox\_7_Source_Code\_1_Projects\hammock-codeplex\src\net40\Hammock.ClientProfile\Mono\HttpUtility.cs:line 1222
at TweetSharp.TwitterService.GetRequestToken(String callback) in C:\Users\Boker\Desktop\tweetsharp-master\src\net40\TweetSharp.Next\Service\TwitterService.OAuth.cs:line 171
at TweetSharp.TwitterService.GetRequestToken() in C:\Users\Boker\Desktop\tweetsharp-master\src\net40\TweetSharp.Next\Service\TwitterService.OAuth.cs:line 184
at TweetSharp.Tests.Service.TwitterServiceTests.Can_exchange_for_access_token() in C:\Users\Boker\Desktop\tweetsharp-master\src\net40\TweetSharp.Next.Tests\Service\TwitterServiceTests.OAuth.cs:line 26
Upvotes: 2
Views: 417
Reputation: 51
Calling GetRequestToken returns an exception. I then reviewed TwitterService.Response and found this exception: The underlying connection was closed: An unexpected error occurred on a send. Solution reference: ..The underlying connection was closed: An unexpected error occurred on a receive
Thus, add this before calling a TweetSharp method.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
Upvotes: 5