Bug 41206 - HTTPS fails when using the managed HttpClient handler with Apple's TLS
Summary: HTTPS fails when using the managed HttpClient handler with Apple's TLS
Status: VERIFIED FIXED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Base Class Libraries ()
Version: 2.8.0 (C7)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 2.8.x (C7SR0)
Assignee: Martin Baulig
URL:
Depends on:
Blocks:
 
Reported: 2016-05-20 09:43 UTC by Alberto GH
Modified: 2016-07-13 17:13 UTC (History)
25 users (show)

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


Attachments
Repro in XM (347.68 KB, application/zip)
2016-05-24 15:17 UTC, Chris Hamons
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 Alberto GH 2016-05-20 09:43:38 UTC
Steps to reproduce:

1) Create a Xamarin.Mac app
2) Open target Options -> Mac Build
2) Make sure "HttpClient Default Handler" is set to Managed (default value)
3) Make sure "SSL/TLS Implementation" is set to Apple TLS (again, this is the default value)
4) Try to send an HTTPS request, it will always fail with: Mono.Security.Interface.TlsException: Unknown Secure Transport error `ClosedGraceful'

FULL EXCEPTION STACK:

> e
{Mono.Security.Interface.TlsException: Unknown Secure Transport error `ClosedGraceful'.
  at System.Net.WebConnectionStream.EndWrite (IAsyncResult r) [0x000d3] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System/System.Net/WebConnectionStream.cs:616 
  at System.IO.Stream.<BeginEndWriteAsync>m__8 (System.IO.Stream stream, IAsyncResult asyncResult) [0x00000] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/io/stream.cs:729 
  at (wrapper delegate-invoke) System.Func`3[System.IO.Stream,System.IAsyncResult,System.Threading.Tasks.VoidTaskResult]:invoke_TResult_T1_T2 (System.IO.Stream,System.IAsyncResult)
  at System.Threading.Tasks.TaskFactory`1+FromAsyncTrimPromise`1[TResult,TInstance].Complete (TInstance thisRef, System.Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization) [0x00002] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/threading/Tasks/FutureFactory.cs:1441 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:447 
  at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x00310] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:364 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535 
  at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x000a9] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:276 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 
  at MyNamespace.MyClass+<MyMethod>c__async0.MoveNext () [0x00272] in /Users/fiam/Projects/Whatever.cs:38 }
	Alert: {[Alert: Fatal:InternalError]}
	Data: Count = 0
	HResult: -2146233088
	HelpLink: (null)
	InnerException: (null)
	Message: "Unknown Secure Transport error `ClosedGraceful'."
	Source: "mscorlib"
	StackTrace: "  at System.Net.WebConnectionStream.EndWrite (IAsyncResult r) [0x000d3] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System/System.Net/WebConnectionStream.cs:616 \n  at System.IO.Stream.<BeginEndWriteAsync>m__8 (System.IO.Stream stream, IAsyncResult asyncResult) [0x00000] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/io/stream.cs:729 \n  at (wrapper delegate-invoke) System.Func`3[System.IO.Stream,System.IAsyncResult,System.Threading.Tasks.VoidTaskResult]:invoke_TResult_T1_T2 (System.IO.Stream,System.IAsyncResult)\n  at System.Threading.Tasks.TaskFactory`1+FromAsyncTrimPromise`1[TResult,TInstance].Complete (TInstance thisRef, System.Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization) [0x00002] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/threading/Tasks/FutureFactory.cs:1441 \n--- End of stack trace from previous location where exception was thrown ---\n  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 \n  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 \n  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 \n  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 \n  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:447 \n  at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x00310] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:364 \n--- End of stack trace from previous location where exception was thrown ---\n  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 \n  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 \n  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 \n  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 \n  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535 \n  at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x000a9] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:276 \n--- End of stack trace from previous location where exception was thrown ---\n  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 \n  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 \n  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 \n  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 \n  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 \n  at MyNamespace.MyClass+<MyMethod>c__async0.MoveNext () [0x00272] in /Users/fiam/Projects/Whatever.cs:38 "
	TargetSite: {Void Throw()}
	Non-public members: 
>

SYSTEM DETAILS (from Xamarin Studio's about window):

Xamarin Studio Business
Version 6.0 (build 5156)
Installation UUID: 3761a7b4-a63f-46dd-b9f4-19bd3e97b27c
Runtime:
	Mono 4.4.0 (mono-4.4.0-branch/0f5fdf2) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000168

Xamarin.Profiler
Version: 0.0.0.0
Location: /Applications/XamarinProfiler.Mac.app/Contents/MacOS/XamarinProfiler.Mac

Apple Developer Tools
Xcode 7.3.1 (10188.1)
Build 7D1014

Xamarin.iOS
Version: 9.8.0.318 (Xamarin Business)
Hash: efefc1e
Branch: cycle7
Build date: 2016-05-13 17:19:05-0400

Xamarin.Android
Version: 6.1.0.56 (Xamarin Business)
Android SDK: /Users/fiam/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)

SDK Tools Version: 24.1.2
SDK Platform Tools Version: 21.0.0
SDK Build Tools Version: 21.1.2

Java SDK: /usr
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)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Xamarin Android Player
Not Installed

Xamarin.Mac
Version: 2.8.0.318 (Xamarin Business)

Build Information
Release ID: 600005156
Git revision: 6bb41168165682b4ed22a94364bf0cf24e6b1d5c
Build date: 2016-05-13 16:06:44-04
Xamarin addins: 32a8312bbbe9be707b6535e19c0ed3c4e4f27443
Build lane: monodevelop-lion-cycle7

Operating System
Mac OS X 10.11.5
Darwin muk.local 15.5.0 Darwin Kernel Version 15.5.0
    Tue Apr 19 18:36:36 PDT 2016
    root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
Comment 1 Alberto GH 2016-05-20 09:46:35 UTC
Forgot to mention that the rest of HttpClient / TLS combinations (CFNetwork + Apple TLS, NSUrlSession + Apple TLS, Managed + Mono TLS) work fine.
Comment 2 Chris Hamons 2016-05-20 15:10:27 UTC
Hmm. My little example I tried over here works.

Could you please attach an example project, or at very least the code that you are using the make the request (there are multiple different ways you could do it)?
Comment 3 Alberto GH 2016-05-20 15:39:24 UTC
Hi Chris,

Unfortunately, this is happening on a pretty large project and extracting just the code for the request would be non trivial.

Just in case it might be helpful, the exact request is a PUT with a ~100K body. The code is:

var client = new HttpClient ();
var requestBody = new StringContent (... acquire body ...);
try {
   var resp = await client.PutAsync (uri, requestBody);
....
Comment 4 Rolf Bjarne Kvinge [MSFT] 2016-05-23 08:29:39 UTC
@Martin, is this something in your area?
Comment 5 Martin Baulig 2016-05-23 19:01:13 UTC
ClosedGraceful should not be an error condition.  A test case would really help here.
Comment 6 Daniel Smith 2016-05-24 02:39:40 UTC
For what is worth, I am building Xamarin.iOS app using the Azure Blob Storage component by DataNuage S.A.S. and since upgrading to latest version of Xamarin (beta channel) I am seeing the exact same results anytime I attempt to upload a blob to Azure over HTTPS connection.  Here is my version information:

=== Xamarin Studio Community ===

Version 6.0 (build 5156)
Installation UUID: 8d93f3f4-c4b1-4ebb-8cef-b742057cdf6d
Runtime:
	Mono 4.4.0 (mono-4.4.0-branch/0f5fdf2) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000168

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.3.1 (10188.1)
Build 7D1014

=== Xamarin.iOS ===

Version: 9.8.0.318 (Xamarin Studio Community)
Hash: efefc1e
Branch: cycle7
Build date: 2016-05-13 17:19:05-0400

=== Xamarin.Android ===

Version: 6.1.0.56 (Xamarin Studio Community)
Android SDK: /Users/Daniel/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)

SDK Tools Version: 24.0.2
SDK Platform Tools Version: 21.0.0
SDK Build Tools Version: 21.1.2

Java SDK: /usr
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)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Not Installed

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 600005156
Git revision: 6bb41168165682b4ed22a94364bf0cf24e6b1d5c
Build date: 2016-05-13 16:06:44-04
Xamarin addins: 32a8312bbbe9be707b6535e19c0ed3c4e4f27443
Build lane: monodevelop-lion-cycle7

=== Operating System ===

Mac OS X 10.11.4
Darwin Daniels-Mac-mini.local 15.4.0 Darwin Kernel Version 15.4.0
    Fri Feb 26 22:08:05 PST 2016
    root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
Comment 7 Sebastien Pouliot 2016-05-24 14:20:55 UTC
It might not be related to the operation (upload) but to the server itself. We need an "endpoint", URL to a server, that will reproduce the issue.
Comment 8 Alberto GH 2016-05-24 15:12:51 UTC
Just made a short reproducible test case. Create a new Xamarin.Mac app and put this code in DidFinishLaunching

 public override void DidFinishLaunching (NSNotification notification)
        {
            // Insert code here to initialize your application
            var client = new HttpClient ();
            var body = new ByteArrayContent (new byte [100 * 1024]);
            var resp = client.PutAsync ("https://httpbin.org/post", body);
            resp.Wait ();
        }

I'm calling Wait() manually to avoid complicating the sample with async/await, but the result should be the same. Exception trace follows:

System.AggregateException: One or more errors occurred. ---> Mono.Security.Interface.TlsException: Unknown Secure Transport error `ClosedGraceful'.
  at System.Net.WebConnectionStream.EndWrite (IAsyncResult r) [0x000d3] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System/System.Net/WebConnectionStream.cs:616
  at System.IO.Stream.<BeginEndWriteAsync>m__8 (System.IO.Stream stream, IAsyncResult asyncResult) [0x00000] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/io/stream.cs:729
  at at (wrapper delegate-invoke) System.Func`3[System.IO.Stream,System.IAsyncResult,System.Threading.Tasks.VoidTaskResult]:invoke_TResult_T1_T2 (System.IO.Stream,System.IAsyncResult)
  at System.Threading.Tasks.TaskFactory`1+FromAsyncTrimPromise`1[TResult,TInstance].Complete (TInstance thisRef, System.Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization) [0x00002] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/threading/Tasks/FutureFactory.cs:1441
  at --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:447
  at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x00310] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:364
  at --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535
  at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x000a9] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:276
  --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (Boolean includeTaskCanceledExceptions) [0x00014] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/threading/Tasks/Task.cs:2157
  at System.Threading.Tasks.Task.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken) [0x00052] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/threading/Tasks/Task.cs:3189
  at System.Threading.Tasks.Task.Wait () [0x00000] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/threading/Tasks/Task.cs:3054
  at MacTest2.AppDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00025] in /Users/fiam/Projects/MacTest2/MacTest2/AppDelegate.cs:20
  at at (wrapper managed-to-native) AppKit.NSApplication:NSApplicationMain (int,string[])
  at AppKit.NSApplication.Main (System.String[] args) [0x00041] in /Users/builder/data/lanes/2922/efefc1ed/source/maccore/src/AppKit/NSApplication.cs:94
  at MacTest2.MainClass.Main (System.String[] args) [0x00007] in /Users/fiam/Projects/MacTest2/MacTest2/Main.cs:10
Comment 9 Alberto GH 2016-05-24 15:14:06 UTC
Forgot to mention that you should add System.Net.Http as a reference, although I guess that should be obvious.
Comment 10 Chris Hamons 2016-05-24 15:17:19 UTC
Created attachment 16088 [details]
Repro in XM
Comment 11 Chris Hamons 2016-05-24 15:17:44 UTC
@Alberto Perfect! That hits it right away on my end.
Comment 12 Phillip Wells 2016-06-01 23:21:24 UTC
Just hit this when moving from stable to beta channel.

I'm doing Azure Mobile Services.
Comment 13 Martin Baulig 2016-06-02 16:33:29 UTC
I can reproduce this locally and am currently working on a fix.
Comment 14 Adam 2016-06-03 14:02:30 UTC
Any news of a workaround? Just hit this when moving from Stable to Beta.
Comment 15 Karl 2016-06-04 03:26:58 UTC
Just hit this as well. Any update/work around avail? Tried moving to the other transport libs, but causes other issues.
Comment 16 Denis Kornev 2016-06-07 08:18:29 UTC
I'm still having this issue on iOS in Xamarin Studio 6.0 (build 5174) and Xamarin.iOS 9.8.0.323 from beta channel. And this issues is not reproduced in Xamarin Studio from alpha channel.
Comment 17 Adam 2016-06-08 17:57:05 UTC
Just to confirm - this seems to go wrong in the Stable Channel after updating to iOS 9.8.0.323
Comment 18 Sebastien Pouliot 2016-06-08 18:01:59 UTC
In both XM and XI you can select the older/existing managed Mono TLS stack until SR1 is out with a fix.
Comment 19 Martin Baulig 2016-06-08 21:06:30 UTC
Fixed in maccore/cycle7 1caf99d and xamarin-macios/master fe396d6.
Comment 20 kpickard@flightdocs.com 2016-06-09 17:25:21 UTC
@martin do you know what version of Xamarin.iOS this will be included in?  will there be a patch to 9.8 or do we need to wait for 9.9 which is in the alpha channel
Comment 21 aed 2016-06-09 23:26:18 UTC
@Martin - anybody knows what triggers this on Xamarin.iOS? I am getting reports in Insights of it happening since today's update but it is quite rare. All our HTTPS requests are POSTs and this seems to happen in maybe 1% of the cases.
Comment 22 Antony Harris 2016-06-10 12:17:58 UTC
@martin. I updated Xamarin 6.0 (5174) yesterday and since then I have had the same problem with REST and HttpClient. GET requests are fine, but POST requests have no data in the payload.
Comment 23 Antony Harris 2016-06-10 13:10:05 UTC
Have found that I was able to work around the issues but using a combination of:

HttpClient Implementation: Managed
SSL/TLS implementation: Mono

Without using that combination the POST data was being lost in both HttpClient and in RestClient.
Comment 24 Gilles Dignard 2016-06-11 16:25:46 UTC
Updated to latest; and it's happening here as well.

I want to add, though, that while POST is broken, the body payload doesn't seem to get lost with a PUT

This is hitting us hard; glad to hear that it's reproducible
Comment 26 Jayden Spring 2016-06-13 09:57:27 UTC
This has been marked as Resolved? Resolved in the Alpha branch? When would we see this come through to Stable as it is rather a big issue.
Comment 27 Antony Harris 2016-06-13 10:52:40 UTC
Further to my previous comments, if you select Mono TLS in the iOS build, save and exit Xamarin and restart and load the asolution, the iOS build setting has gone back to Apple TLS.

So you have to remember to set the build back to Mono TLS every time you relaod the solution.
Comment 28 Brendan Zagaeski (Xamarin Team, assistant) 2016-06-13 19:18:38 UTC
## Regression status: new feature bug in the new "Apple TLS" implementation that is set as the default in Cycle 7

This bug is not really a regression, but is instead closer to a "breaking change".  As mentioned in the Xamarin.iOS release notes:

> By default your projects will now use the new Apple TLS stack which
> uses native code (better performance) and support the newest TLS 1.1
> and 1.2 standards. This is a change from previous preview releases of
> XI 9.8.

(https://developer.xamarin.com/releases/ios/xamarin.ios_9/xamarin.ios_9.8/)




## Workaround

For any breakages in behavior that users observe related to TLS after updating to Cycle 7, the first step to try to attempt to resolve the issue is to switch back to the old implementation of the TLS stack that was used in Cycle 6:

Under "Project Options > iOS Build", change the "SSL/TLS implementation" setting back to the old default "Mono (TLS v1.0)".




## Bug status details

Note that the "Resolved" status indicates:

> A resolution has been performed, and it is awaiting verification by QA.

(https://bugzilla.xamarin.com/page.cgi?id=fields.html#bug_status)


"A resolution" in this context means only that a candidate fix has been committed to the source code.  Xamarin's Bugzilla does not at the moment have a field that corresponds to the _release status_ of a bug.


That said, I am now updating the "Target Milestone" of the bug to "2.8.7 (C7SR0)"for accuracy.  That target milestone means that this bug has been added to a small list of high priority follow-up fixes for Cycle 7 that will be published in a release named "Service Release 0" on a tentative time scale of roughly 1 week.  Again, keep in mind that this bug is not really a regression and that it is possible to switch back to the old (unchanged) TLS implementation from Cycle 6 by switching a project configuration setting.
Comment 29 Brendan Zagaeski (Xamarin Team, assistant) 2016-06-13 20:03:57 UTC
## Additional visibility in release notes

As a side note for thorough bookkeeping, I will be working on increasing the visibility in the release notes of this "big" change that Cycle 7 now uses the new Apple TLS implementation by default.
Comment 30 Dennis Welu 2016-06-14 21:04:22 UTC
FWIW I have also seen the behavior cited by @Anthony Harris in comment 27 where the project fails to retain the switch back to the Mono TLS implementation.
Comment 31 Vincent Dondain [MSFT] 2016-06-16 13:16:13 UTC
@anthony & @dennis, I cannot reproduce what you're experiencing with the "non persistant" Mono TLS build option with the current stable builds:

=======

Xamarin Studio Enterprise
Version 6.0 (build 5174)
Installation UUID: 276439ce-67ad-434d-89e9-b46e0bdbc7ce
Runtime:
	Mono 4.4.0 (mono-4.4.0-branch-c7-baseline/5995f74) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000182

Xamarin.iOS
Version: 9.8.0.323 (Xamarin Enterprise)
Hash: 39ebb77
Branch: cycle7
Build date: 2016-06-01 21:23:15-0400

=======

When selecting Mono TLS we write <MtouchTlsProvider>Legacy</MtouchTlsProvider> in the csproj, so I don't see how the option could not be retained or how the UI could not display it.

If such a bug in the behavior is happening, I'd be happy to fix it but I would need some repro steps, in that case please feel free to open a new bug against the iOS add-in as this is a totally separate issue.
Comment 32 Dennis Welu 2016-06-16 14:26:06 UTC
Understood. FWIW when it was reset I then went in and changed it for each config, hit OK on the dialog, reopened and did the same thing for the next config. It seems to have retained ok so far...
Comment 33 Vincent Dondain [MSFT] 2016-06-16 14:39:44 UTC
Maybe the confusion is that the option has to be set for each build config.

If the config is inadvertently changed somewhere else (in the toolbar for instance), when going back to the build options in the preferences, you might have the impression that it has been reseted to the default value, when it's actually the build option view of a different build configuration.
Comment 34 Dennis Welu 2016-06-16 14:54:42 UTC
You might be right. I _thought_ I changed it once per config the first time and _then_ hit OK. But you know how memories are...
Comment 35 Auri Rahimzadeh 2016-06-17 17:17:40 UTC
FWIW, I've noticed smaller POSTs being sent work fine. It's larger requests that are causing trouble... Such as when I send an encoded file to an SSL endpoint. Sounds like there's a fix, but thought that info may be helpful to somebody :)