Closed
Description
Description
Calling the method System.Net.SafeDeleteSslContext:ReadFromConnection
in AOT compiled code leads to:
ExecutionEngineException: Attempting to JIT compile method '(wrapper native-to-managed) in System.Net.SafeDeleteSslContext:ReadFromConnection (void*,byte*,void**)' while running in aot-only mode.
This is the complete stack trace from our test:
[FAIL] TestNSUrlSessionHandlerCookies : Exception
Expected: null
But was: <System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
---> System.ExecutionEngineException: Attempting to JIT compile method '(wrapper native-to-managed) in System.Net.SafeDeleteSslContext:ReadFromConnection (void*,byte*,void**)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
at System.Net.SafeDeleteSslContext..ctor(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions) in System.Net.Security.dll:token 0x6000191+0xfc
at System.Net.Security.SslStreamPal.HandshakeInternal(SafeFreeCredentials credential, SafeDeleteSslContext& context, ReadOnlySpan`1 inputBuffer, Byte[]& outputBuffer, SslAuthenticationOptions sslAuthenticationOptions) in System.Net.Security.dll:token 0x6000407+0x10
--- End of inner exception stack trace ---
at System.Net.Security.SslStream.<ForceAuthenticationAsync>d__172`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext() in System.Net.Security.dll:token 0x600030e+0x1f6
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Boolean async, Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken) in System.Net.Http.dll:token 0x600051e+0x95
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Boolean async, Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken) in System.Net.Http.dll:token 0x600051e+0x138
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) in System.Net.Http.dll:token 0x60006ff+0x410
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) in System.Net.Http.dll:token 0x6000701+0x8f
at System.Net.Http.HttpConnectionPool.SendUsingHttp11Async(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) in System.Net.Http.dll:token 0x60006f1+0x15d
at System.Net.Http.HttpConnectionPool.DetermineVersionAndSendAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) in System.Net.Http.dll:token 0x60006f2+0x224
at System.Net.Http.HttpConnectionPool.SendAndProcessAltSvcAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) in System.Net.Http.dll:token 0x60006f3+0x8e
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) in System.Net.Http.dll:token 0x60006f4+0x99
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) in System.Net.Http.dll:token 0x600022f+0x1b7
at MonoTests.System.Net.Http.MessageHandlerTest.<>c__DisplayClass4_0.<<TestNSUrlSessionHandlerCookies>b__0>d.MoveNext() in xamarin-macios/tests/monotouch-test/System.Net.Http/MessageHandlers.cs:line 106>
at MonoTests.System.Net.Http.MessageHandlerTest.TestNSUrlSessionHandlerCookies() in xamarin-macios/tests/monotouch-test/System.Net.Http/MessageHandlers.cs:line 123
This is the test code: https://github.com/xamarin/xamarin-macios/blob/f5896c14141de86a377044bb0a66bbf8f982a1bb/tests/monotouch-test/System.Net.Http/MessageHandlers.cs#L106
Binlog for the test app: build-MacCatalyst-20210715_143948.binlog.zip
This is the part of the log that corresponds to the AOT compilation: https://gist.github.com/rolfbjarne/fc9f1316a92945fdde0f38ff1ede334f