Errors with Decompression in OAuthAuthorization

May 25, 2010 at 1:41 AM

I'm still coding a "hello world" and when I do an updateStatus("Hello, world"), I get an InvalidOperationException on line 290 of OAuthAuthorization.cs:

            if (this.UseCompression) {
                request.Headers.Add("Accept-Encoding:gzip, deflate");
                request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip; }
The call stack says:

> LinqToTwitter.dll!LinqToTwitter.OAuthAuthorization.InitializeRequest(System.Net.HttpWebRequest request) Line 290 C#

LinqToTwitter.dll!LinqToTwitter.OAuthAuthorization.Post(System.Uri requestUrl, System.Collections.Generic.IDictionary<string,string> args) Line 236 + 0xb bytes C#  LinqToTwitter.dll!LinqToTwitter.TwitterExecute.ExecuteTwitter(string url, System.Collections.Generic.Dictionary<string,string> parameters) Line 470 + 0x1a bytes C#  LinqToTwitter.dll!LinqToTwitter.TwitterExecute.ExecuteTwitter(string url, System.Collections.Generic.Dictionary<string,string> parameters) Line 470 + 0x1a bytes C#  LinqToTwitter.dll!LinqToTwitter.TwitterContext.UpdateStatus(string status, decimal latitude, decimal longitude, string placeID, bool displayCoordinates, string inReplyToStatusID) Line 822 + 0x3a5 bytes C#  LinqToTwitter.dll!LinqToTwitter.TwitterContext.UpdateStatus(string status) Line 677 + 0x7b bytes C#

LinqToTwitterDemo.exe!LinqToTwitterDemo.Program.Main(string[] args) Line 83 + 0x10 bytes C#

 

I don't really care about "decompression" anything and it wouldn't hurt if i skipped this (by setting UseCompression to false) but how would I do that in main() where all I am saying is updateStatus("hello world")?  Also for the record, the status actually gets updated to twitter, but I get an exception and the program crashes every time.

May 25, 2010 at 5:05 AM

Update: Ended up using code from here: http://linqtotwitter.codeplex.com/Thread/View.aspx?ThreadId=210941

Pretty much just copy and pasted. Used string literalls for consumer and token keys, and my "hello world" works perfectly.

Coordinator
May 25, 2010 at 5:20 AM

Hi,

I'm glad you got it working.  I was able to repro and am looking at it.  BTW, you can turn off compression like this:

twitterCtx.AuthorizedClient.UseCompression = false;

Joe

May 25, 2010 at 6:43 PM
Joe, DotNetOpenAuth had a bug fix a few months ago surrounding compression and encodings of requests/responses. LinqToTwitter probably would benefit from an update to the latest version of DNOA. I'm OOF right now though and can't do the update. If you want to do it before I get back, it may help resolve this issue.
May 25, 2010 at 6:44 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
May 26, 2010 at 4:16 AM

Andrew,

Thanks a lot.  I know you're on vacation and I really appreciate it. :)

Joe