Adding microsoft.net.http to an application

nodoidnodoid GBMember, Beta ✭✭✭

Hi,

I'm currently part way through porting an iOS app over to macOS. Pretty much everything is done, but when I come to testing I'm getting this error

Method not found: void System.Net.Http.HttpClientHandler.set_AutomaticDecompression(System.Net.DecompressionMethods)

I'm using FubarRestSharp in my mvvm project which from memory uses Microsoft.Net.Http for the decompression. The answer to get rid of this error is to add the Microsoft.Net.Http package from nuget but the problem is that the version on nuget (2.2.29) isn't happy with macOS. I've tried adding a handler in the code calling the web service, but that's not cutting it either.

I've tried just adding a reference back to the packages, but that's not working either.

Any ideas?

Posts

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    Hmm:

    monodis /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/Xamarin.Mac/System.Net.Http.dll
    monodis /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/4.5/System.Net.Http.dll

    both show

        .method public hidebysig specialname 
               instance default void set_AutomaticDecompression (valuetype [System]System.Net.DecompressionMethods 'value')  cil managed 
    

    So my guess is that you are resolving a copy from a nuget and not the assembly.

    Posting your build log would be helpful to verify this.

Sign In or Register to comment.