Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Android 4.4 device (samsung s3) and android 6 device
HttpClient implementation: "Android client Handler" (Default)
I have been able to make it work using the stable ModernHttpClient nuget, BUT then the app crashes randomly when http calls are made in OkHttp code.
The same app (Xamarin Forms app) works fine on iOS using Apple TLS / NSUrlHandler.
android log contains a message like "can not decrypt" or "can not establish a secure connection" or "can not find an algorithm", can't remember exactly.
The default HTTP handler doesn't support TLS 1.2, you need to use the "AndroidClientHandler" option for the HTTP client - it will work with TLS 1.2 *IF* the underlying Java.NET implementation supports it on your device.
> you need to use the "AndroidClientHandler" option for the HTTP client
I wrote "My HttpClient implementation: "Android client Handler"".
So i'm already using it.
> it will work with TLS 1.2 *IF* the underlying Java.NET implementation supports it on your device.
And what device are supported ? This is not advertised !
I've checked Samsung S3/Android 4.4 and Samsng A3/Android 5.0, both "not supported".
OkHttp does work fine 90% of the time for TSL1.2 on both devices.
But 10% of crash is not acceptable.
You wrote "Android client Handler (Default)" and the default is NOT AndroidClientHandler but the standard System.Net.Http handler which does not support TLS 1.2
As for devices - this is a question for Google, we don't know which Google Android versions and, especially, the modified vendor Android versions, support TLS 1.2
OkHttp (https://square.github.io/okhttp/) is a Java framework, you should file a bug with them if the issue is in their code.
> "Android client Handler (Default)" and the default is NOT AndroidClientHandler
Steps to reproduce:
- Open an android project in Visual Studio.
- Open Properties/Android Options/Advanced.
- In Http client implementation field, hover the blue "i" (informations) icon.
You can read in the first 2 lines:
"Default: if no value is specified, defaults to AndroidClientHandler."
Screen capture: https://justpaste.it/11bxa
Support for TLS 1.2:
OkHttp does support TLS 1.2 on my devices. So my devices support it.
Xamarin 18.104.22.168 (872717c)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android 22.214.171.124 (ce955cc)
Visual Studio extension to enable development for Xamarin.Android.
Xamarin.iOS 10.2.1.5 (44931ae)
Visual Studio extension to enable development for Xamarin.iOS.
It seems that the mono provider is used, even if AndroidClientHandler is specified in the configuration.
It is true that i'm always overriding the HttpClientHandler used by HttpClient, with a custom that derives from HttpClientHandler.
And that is why it was still using the old Mono tls provider.
It is not clear in the Xamarin doc that these options only switched the default handler used, and that custom handler must derive from their respective platform version instead of HttpClientHandler to provide the same level of feature.
So this is resolved. I've switched to AndroidClientHandler and all TLS works much better.
Just update the doc plz.
@softlion, which docs do you have in mind in comment 5?
Related: Bug #49828.