2

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.

Jan
  • 184
  • 2
  • 15

2 Answers2

1

For all who stuck with this problem - add Http Clients lib to your platform projects, not only to shared project.

Jan
  • 184
  • 2
  • 15
0

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

Joe Mayo
  • 7,501
  • 7
  • 41
  • 60
  • Thanks for comment. I've already installed them of course. But it seems like the're not working. There's Microsoft.Bcl,Microsoft.Bcl.Build,Microsoft.Bcl.Compression, Microsoft.Compression. They are all included to the LINQ to Twitter plugin – Jan Feb 12 '16 at 18:07
  • So now I see that you are the author:). So the problem is that it give an exception with Microsoft.Bcl.Compression or Microsoft.Net.Http library when I try to query data. I'm not familiar with them so I don't how they're working internally and what causes error “Method 'HttpClientHandler.set_AutomaticDecompression' not found” – Jan Feb 12 '16 at 18:16