Bug 30608 - Using HttpClient in Android Release Mode & Android Build Developer Instrumentation Option
Summary: Using HttpClient in Android Release Mode & Android Build Developer Instrument...
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 5.1
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2015-05-29 17:49 UTC by Anubhav Ranjan
Modified: 2015-08-10 21:19 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Sample Project (59.32 KB, application/octet-stream)
2015-05-29 17:49 UTC, Anubhav Ranjan

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Anubhav Ranjan 2015-05-29 17:49:03 UTC
Created attachment 11395 [details]
Sample Project

Our customer is facing an issue when using HttpClient in a PCL.

This issue is restricted to Android.

We are using System.Net<http://System.Net>.Http in a PCL in order to query a server for some data. In Debug mode everything works fine. In Release mode, we get exceptions, either NameResolutionFailure (if using a Url with named host), or ConnectFailure (if using a Url with explicit IP Address host).

I followed the recommendations regarding using HttpClient and PCL by James Montemagno (http://motzcod.es/post/78863496592/portable-class-libraries-httpclient-so-happy) and that was unsuccessful.

Then I suspected this to be a Linking issue, and therefore tried including System.Net<http://System.Net>.Http in the Ignore assemblies box of the Linker tab in Release mode. This did not solve the problem either.

Finally, I attempted to mimic the configuration from Debug in Release, and narrowed down the issue to having the Enable Developer Instrumentation on. In Release mode, as long as I have this value checked, regardless of the Linking behaviour value, the issue disappears.

I am not certain what this feature is doing under the hood, so I would like to ask for some clarification and guidance as to how to solve my problem (since this flag is not recommended to be set for Release mode).

#Version Information

Xamarin Studio
Version 5.9.1 (build 3)
Installation UUID: 8fd6d227-391c-4e76-8299-8cf8d8a5022c
Mono 4.0.0 ((detached/d136b79)
GTK+ 2.24.23 (Raleigh theme)

Package version: 400000143

Version: (Business Edition)
Android SDK: /Users/ntayefeh/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
4.2 (API level 17)
4.3 (API level 18)
4.4 (API level 19)
4.4.87 (API level 20)
5.0 (API level 21)
Java SDK: /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Xamarin Android Player
Version: Unknown version
Location: /Applications/Xamarin Android Player.app

Apple Developer Tools
Xcode 6.3.1 (7703)
Build 6D1002

Version: (Business Edition)
Hash: 3c4e832
Branch: master
Build date: 2015-05-20 21:47:57-0400

Not Installed

Build Information
Release ID: 509010003
Git revision: aad75a6e7e48f18120ce41f47d0ff2c6216f49c3
Build date: 2015-05-08 12:46:18-04
Xamarin addins: 1246b3044cbb7f56a217334f8fc5489ef8eefe3f

Operating System
Mac OS X 10.10.3
Comment 4 Nicholas Ventimiglia 2015-08-10 21:19:51 UTC
Ran into this issue. That silent failure was not fun.