Bug 17397 - HTTPS problems in release mode with alpha (4.12.0)
Summary: HTTPS problems in release mode with alpha (4.12.0)
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.12.0
Hardware: Macintosh Mac OS
: Highest blocker
Target Milestone: 4.12.0 (KitKat)
Assignee: Alex Rønne Petersen
URL:
: 17438 17583 ()
Depends on:
Blocks:
 
Reported: 2014-01-23 14:30 UTC by Mart Roosmaa
Modified: 2014-05-12 14:41 UTC (History)
8 users (show)

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


Attachments
Simple test-case demonstrating the bug. (1.23 KB, application/octet-stream)
2014-01-23 14:30 UTC, Mart Roosmaa
Details
The testcase solution. (7.35 KB, application/x-bzip2)
2014-01-23 14:55 UTC, Mart Roosmaa
Details


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:
Status:
VERIFIED FIXED

Description Mart Roosmaa 2014-01-23 14:30:52 UTC
Created attachment 5897 [details]
Simple test-case demonstrating the bug.

With software in the latest alpha channel (Xamarin.Android - 4.12.0, Xamarin Studio - 4.3.1, Mono - 3.2.6) there is a very peculiar bug with System.Net.Http.HttpClient and HTTPS connections. In debug mode everything works, but in release mode "System.Net.WebException: Error: ConnectFailure" exception is thrown.

With stable X.A, XS & Mono everything works as expected.

I've attached a simple test-case to demonstrate the problem.
Comment 1 Jonathan Pryor 2014-01-23 14:45:26 UTC
Please attach a project.

In all likelihood your app is missing the INTERNET permission, which can be set in the Project Options dialog or in AndroidManifest.xml.

http://docs.xamarin.com/recipes/android/general/projects/add_permissions_to_android_manifest/
Comment 2 Mart Roosmaa 2014-01-23 14:50:26 UTC
Actually that's not the case. The INTERNET permission is present. HTTP connections work, HTTPS doesn't. Stable channel works, Alpha has this bug.
Comment 3 Mart Roosmaa 2014-01-23 14:55:47 UTC
Created attachment 5899 [details]
The testcase solution.
Comment 4 Jonathan Pryor 2014-01-23 16:08:48 UTC
Mart: Thank you for the test case.

Alex: This is a blocker linker bug.

Reproduction:
* Build Attachment #5899 [details] in Release mode
* Run
* Tap the button
* View `adb logcat` output.

Expected result:

> I/mono-stdout(13851): Got: <!DOCTYPE html>
> I/mono-stdout(13851): <!--[if lt IE 7]>      <html class="no-js lt-ie10 lt-ie9 lt-ie8 lt-ie7"> <![endif]--

Actual results:

> I/mono-stdout(14125): Failed: System.Net.WebException: Error: ConnectFailure
> I/mono-stdout(14125):   at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 
> I/mono-stdout(14125):   at System.Threading.Tasks.TaskFactory`1[System.Net.WebResponse].InnerInvoke (System.Threading.Tasks.TaskCompletionSource`1 tcs, System.Func`2 endMethod, IAsyncResult l) [0x00000] in <filename unknown>:0 
> I/mono-stdout(14125): --- End of stack trace from previous location where exception was thrown ---
> I/mono-stdout(14125):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
> I/mono-stdout(14125):   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[System.Net.WebResponse].GetResult () [0x00000] in <filename unknown>:0 
> I/mono-stdout(14125):   at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x00000] in <filename unknown>:0 
> I/mono-stdout(14125): --- End of stack trace from previous location where exception was thrown ---
> I/mono-stdout(14125):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
> I/mono-stdout(14125):   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[System.Net.Http.HttpResponseMessage].GetResult () [0x00000] in <filename unknown>:0 
> I/mono-stdout(14125):   at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x00000] in <filename unknown>:0 
> I/mono-stdout(14125): --- End of stack trace from previous location where exception was thrown ---
> I/mono-stdout(14125):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
> I/mono-stdout(14125):   at System.Runtime.CompilerServices.TaskAwaiter`1[System.Net.Http.HttpResponseMessage].GetResult () [0x00000] in <filename unknown>:0 
> I/mono-stdout(14125):   at SslBug.MainActivity+<OnCreate>c__AnonStorey1+<OnCreate>c__async0.MoveNext () [0x00000] in <filename unknown>:0 

If you _disable_ linking in the Release mode, the app will operate as expected.
Comment 5 Jonathan Pryor 2014-01-27 15:40:38 UTC
*** Bug 17438 has been marked as a duplicate of this bug. ***
Comment 6 Jonathan Pryor 2014-02-04 14:37:18 UTC
*** Bug 17583 has been marked as a duplicate of this bug. ***
Comment 7 PJ 2014-02-24 10:45:43 UTC
This is working for me with 4.12.0.28. 

Screencast: http://screencast.com/t/nOwt1f063uhK
Comment 8 Sadik Ali 2014-03-26 03:34:54 UTC
I have verified this issue and noticed that this is working.
Refer screen cast: http://www.screencast.com/t/LSOWZMbJ

Hence I marked this as verified.
Environment Info: 

=== Xamarin Studio ===
Version 4.2.4 (build 32)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
Runtime:
 Mono 3.2.7 ((no/40f92d5)
 GTK+ 2.24.23 (Raleigh theme)

 Package version: 302070000

=== Xamarin.Android ===
Version: 4.12.3 (Trial Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
 Supported Android versions:
  1.6   (API level 4)
  2.2   (API level 8)
  2.3   (API level 10)
  3.1   (API level 12)
  3.2   (API level 13)
  4.0   (API level 14)
  4.0.3 (API level 15)
  4.1   (API level 16)
  4.2   (API level 17)
  4.3   (API level 18)
  4.4   (API level 19)
Java SDK: /usr
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

=== Apple Developer Tools ===
Xcode 4.6.3 (2068)
Build 4H1503

=== Xamarin.Mac ===
Xamarin.Mac: 1.6.27

=== Xamarin.iOS ===
Version: 7.2.1.25 (Trial Edition)

=== Build Information ===
Release ID: 402040032
Git revision: a160c35dac9ab9fd32eeadaa171216316d5a5133
Xamarin addins: a779416ceabd54981ce812771a4061c942e8b872

=== Operating System ===
Mac OS X 10.7.5
Darwin Jatin66s-iMac.local 11.4.2 Darwin Kernel Version 11.4.2
    Thu Aug 23 16:25:48 PDT 2012
    root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
Comment 9 Dylan 2014-03-26 05:18:46 UTC
Just to check, we are receiving various error reports on our apps with Xamarin.Android 4.12.2 along the lines of what is described in this report. 

This issue is marked as fixed, in which version has this been fixed?
Comment 10 v7d 2014-05-11 21:46:36 UTC
We are observing the same symptoms- httpclient failing to load only in release mode calling HTTPS service. What is worse, in our setup it is silently failing with no logcat output of exceptions. 

 We are using Xamarin.Android 4.12.4.10
Comment 11 Alex Rønne Petersen 2014-05-12 13:37:47 UTC
Hi! Unless the problems you are seeing are exactly like this one, please file separate bugs with repro project(s) attached and assign me.
Comment 12 Peter Collins 2014-05-12 14:41:13 UTC
@v7d I've filed a new bug for your issue as Bug 19690. Please update that bug with more information when you get the chance!