I have Xamarin.Android, Xamarin.iOS, and Windows Phone 8 apps that reference the common PCL library. Inside this library I use HttpClient, and since WP8 I need the nuget packageMicrosoft.Net.Http.2.2.22
Without enabling compression on HttpClient, everything works fine on all three platforms. However, after changing the code to
var handler = new HttpClientHandler();
if (handler.SupportsAutomaticDecompression)
{
handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
}
httpClient = new HttpClient(handler);
There is a build error with the library in iOS (both Android and WP do a great job of this), telling me about a few definitions DecompressionMethods. What is strange - the second assembly mentioned in the error System.Net.Primitives.dllis that it does NOT contain DecompressionMethods method definitions (I even checked in ILSpy).
Of course, I tried to clear the solution, rebuild, close / open Xamarin Studio, etc.
Error:
MyApiHttpClient.cs(30,50): error CS0433: The imported type `System.Net.DecompressionMethods' is defined multiple times
/Users/vtoth/myprototype/Services/CommonServices/../../packages/Microsoft.Net.Http.2.2.22/lib/portable-net40+sl4+win8+wp71+wpa81/System.Net.Http.Primitives.dll (Location of the symbol related to previous error)
/Library/Frameworks/Mono.framework/Versions/3.2.6/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile49/System.Net.Primitives.dll (Location of the symbol related to previous error)
Task "Csc" execution -- FAILED
Done building target "CoreCompile" in project "/Users/vtoth/myprototype/Services/CommonServices/CommonServices.csproj".-- FAILED
EDIT:
:
=== Xamarin Studio ===
4.2.4 ( 35) UUID: (...) : Mono 3.2.6 ((/9b58377) GTK + 2.24.23 ( )
: 302060000
=== Apple ===
Xcode 5.1.1 (5085) Build 5B1008
=== Xamarin.iOS ===
: 7.2.1.42 (-) : 773c77c : : 2014-04-18 15: 39: 16-0400
=== Xamarin.Mac ===
Xamarin.Mac:
=== Xamarin.Android ===
: 4.12.3 ( ) Android SDK: //vtoth/Library//Xamarin/android-sdk-mac_x86 Android: 2.1 ( API 7) 2.2 ( API 8) 2.3 ( API 10) 3.1 ( API 12) 4.0 ( API 14) 4.0.3 ( API 15) 4.3 ( API 18) 4.4 (API- 19) Java SDK:/usr java version "1.6.0_65" Java (TM) SE Runtime Environment ( 1.6.0_65-b14-462-11M4609) Java HotSpot (TM) 64- VM ( 20.65-b04-462, )
=== ===
: 402040035 Git : 1173cb1c45bc56cb702e82cd21a7c9d0cea4acbf : 2014-04-17 13: 45: 52-04 Xamarin addins: 53bde0041263928e8bd64686f5ca5a8e4338dd76
=== ===
Mac OS X 10.9.2