Skip to content

Using Apple Network Framework and WebSockets #123395

@lilleyd

Description

@lilleyd

Apple platform

iOS

Framework version

net10.0-*

Affected platform version

.Net 10.0.101

Description

We are connecting to Trade Republic with an web socket and we experience ssl failure when we connect with Apple Network Framework and WebSockets, when not using Apple Network Framework, the WebSockets work fine.

net_webstatus_ConnectFailure
net_http_ssl_connection_failed
Arg_NullReferenceException
 

System.Net.WebSockets.WebSocketException (0x80004005): net_webstatus_ConnectFailure
---> System.Net.Http.HttpRequestException: net_http_ssl_connection_failed
---> System.NullReferenceException: Arg_NullReferenceException
   at System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller`1.ManagedToUnmanagedIn[[Microsoft.Win32.SafeHandles.SafeX509ChainHandle, System.Security.Cryptography, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].FromManaged(SafeX509ChainHandle )
   at Interop.AppleCrypto.X509ChainGetChainSize(SafeX509ChainHandle )
   at System.Net.CertificateValidationPal.GetRemoteCertificate(SafeDeleteContext , Boolean , X509Chain& , X509ChainPolicy )
   at System.Net.CertificateValidationPal.GetRemoteCertificate(SafeDeleteContext , X509Chain& , X509ChainPolicy )
   at System.Net.Security.SslStream.VerifyRemoteCertificate(RemoteCertificateValidationCallback , SslCertificateTrust , ProtocolToken& , SslPolicyErrors& , X509ChainStatusFlags& )
   at System.Net.Security.SslStream.CompleteHandshake(ProtocolToken& , SslPolicyErrors& , X509ChainStatusFlags& )
   at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions )
   at System.Net.Security.SslStream.<ForceAuthenticationAsync>d__159`1[[System.Net.AsyncReadWriteAdapter, System.Net.Security, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions , HttpRequestMessage , Boolean , Stream , CancellationToken )
   Exception_EndOfInnerExceptionStack
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions , HttpRequestMessage , Boolean , Stream , CancellationToken )
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage , Boolean , CancellationToken )
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage , Boolean , CancellationToken )
   at System.Net.Http.HttpConnectionPool.InjectNewHttp11ConnectionAsync(QueueItem )
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.<WaitWithCancellationAsync>d__1[[System.Net.Http.HttpConnection, System.Net.Http, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage , Boolean , Boolean , CancellationToken )
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage , Boolean , CancellationToken )
   at System.Net.Http.SocketsHttpHandler.<SendAsync>g__CreateHandlerAndSendAsync|115_0(HttpRequestMessage , CancellationToken )
   at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri , HttpMessageInvoker , CancellationToken , ClientWebSocketOptions )
   at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri , HttpMessageInvoker , CancellationToken , ClientWebSocketOptions )
   at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri , HttpMessageInvoker , CancellationToken )
   at Subsembly.Scraper.ScraperSessionTradeRepublic.EmbeddedWebSocketClient.Connect()
   at Subsembly.Scraper.ScraperSessionTradeRepublic.OnContinueLogin(SepaAccount[]& vAccts, JsonObject jsCredential)
   at Subsembly.Scraper.ScraperSession.ContinueLogin(JsonObject jsCredential)
 
#### Fehler: net_webstatus_ConnectFailure
net_http_ssl_connection_failed
Arg_NullReferenceException

Steps to Reproduce

Unfortunately I cannot provide an example for you to test as it is behind credentials of a bank.

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions