Getting System.MissingMethodException on all calls

Feb 19, 2014 at 6:46 AM
Edited Feb 19, 2014 at 6:48 AM
I created a new Portable Class Library project in VS 2013, used Nuget to add your library (v3.0.2) and can build the project without errors.

I then added a Unit Test project and using single user authentication I can create the context and tried various very simple such as: Search, Get a users timeline, Get a timeline stream, etc.

One example of my code:
        public async Task GetTweets()
        {
            var twitterCtx = new TwitterContext(TweetFetcher.getAuthorization());

            // Exception happens when I run the code below or any other sample I tried
            var tl =
                await
                (from tweet in twitterCtx.Status
                where tweet.Type == LinqToTwitter.StatusType.Home
                select tweet)
                .ToListAsync();
        }
It seems though that no matter what I try it all fails with the exception below. Any ideas?

thank you :).

Error details:

System.MissingMethodException: Method not found: 'Void System.Net.Http.HttpClientHandler.set_Proxy(System.Net.IWebProxy)'.
Result StackTrace: ...
Feb 19, 2014 at 7:46 AM
After a bit more painful trial and error and searching for a solution I figured out the cause, its the same issue that is reported here:

http://stackoverflow.com/questions/17988628/method-not-found-when-setting-proxy-in-httpclienthandler-portable-class-library

For those who want to save an extra click this is the important reply in the link above:
This error is due to the HttpClient package not being installed on the consuming project. You should be getting a warning similar:

All projects referencing [consuming project] must install nuget package Microsoft.Bcl.Build.

Basically, every referencing a class library that references HttpClient & Async must also reference HttpClient & Async.
So basically I was not adding the right Nuget package to the caller library that used the PCL. Now it works, glad it was just simple user error and I hope this post helps others.