Search code examples
xamarinlinq-to-twitter

Twitter query fails with exception "Method 'HttpClientHandler.set_AutomaticDecompression' not found"


I'm using Xamarin and LinqToTwitter plugin. What I want is just to fetch messages with some tag. But even simplest query fails because of error "Method 'HttpClientHandler.set_AutomaticDecompression' not found".

try
        {
            var context = GetTwitterContext();

            var searchResponses = ( from search in context.Search 
                                    where search.Type == SearchType.Search && search.Query == "Xamarin"
                                    select search.Statuses).SingleOrDefault();



            var tweets = from tweet in searchResponses
                select new Message
            {
                Value = tweet.Text,
                Id = tweet.TweetIDs,
                ImageUri = tweet.User.ProfileImageUrl,
                UserName = tweet.User.ScreenNameResponse,
                Name = tweet.User.Name,
                CreatedAt = tweet.CreatedAt,
                ReTweets = tweet.RetweetCount,
                Favorite = tweet.FavoriteCount.Value
            };

            return tweets.ToList();
        }
        catch (Exception ex)
        {
            ex.Message.ToString();
        }

When I look at the exception, there's a source: "mscorlib". So I'm wondering what can be wrong, because it seems like plugin Microsoft.Bcl.Compression is OK.

Also I changed my packages.config "LinkToTwitter" to lowercase "linqtotwitter" but it barely helps.

Will be grateful for any help.


Solution

  • LINQ to Twitter has a dependency on HttpClient. You should install that from NuGet Microsoft HTTP Client Libraries.