Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xamarin Android & Websockets #41835

Closed
1 task done
SSpormann opened this issue May 25, 2022 · 88 comments
Closed
1 task done

Xamarin Android & Websockets #41835

SSpormann opened this issue May 25, 2022 · 88 comments
Assignees
Labels
area-signalr Includes: SignalR clients and servers External This is an issue in a component not contained in this repository. It is open for tracking purposes. investigate

Comments

@SSpormann
Copy link

SSpormann commented May 25, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I am trying to support websockets with signalR 6 on Android, with a Xamarin app, my code works as intended with longpolling, but there are clear benefits for me in using websockets, and I now have tried for a long time to make this work. But if I set supported transports to Websockets only in the client I get the error message that Longpolling is dissabled in the client, but the server does provide Longpolling,
Unable to connect to the server with any of the available transports. (WebSockets failed: Unable to connect to the remote server) (LongPolling failed: The transport is disabled by the client.)

My client, does look like this;

this._connection = new HubConnectionBuilder()
            .WithUrl($"{_host}/rabbitHub?deviceId={id}", (opts) =>
            {
                opts.HttpMessageHandlerFactory = (x) => new HttpClientHandler
                {
                    ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator,
                };
                opts.AccessTokenProvider = () => Task.FromResult(authToken ?? "bypassauthplz");
                opts.Transports = Microsoft.AspNetCore.Http.Connections.HttpTransportType.WebSockets /*| Microsoft.AspNetCore.Http.Connections.HttpTransportType.ServerSentEvents | Microsoft.AspNetCore.Http.Connections.HttpTransportType.LongPolling*/;
            }  )
            .WithAutomaticReconnect()
            .ConfigureLogging(logging =>
            {
                logging.SetMinimumLevel(LogLevel.Trace);
            }).Build();

and the Server is configured like this:
services.AddSignalR().AddHubOptions<RabbitHub>(options => { options.MaximumParallelInvocationsPerClient = 32; options.KeepAliveInterval = new TimeSpan(0,0,0,5); options.ClientTimeoutInterval = new TimeSpan(0,0,0,10); });

endpoints.MapHub<RabbitHub>("/rabbitHub", options => { options.Transports = HttpTransportType.WebSockets | HttpTransportType.LongPolling | HttpTransportType.ServerSentEvents; });

Expected Behavior

The Expected behavior would be that the client would be aple to connect to the SignalR Server via websockets, this seems to be no Problem with Android, if I connect to an non signalR Websocket I with System.Net.WebSockets, everithing is working as intendet.
So there has to be a bug in the Aspnet.core lib.

I'am using this lib with netstandard 2.1 for the client and .net6 for the server, but changing the server from 5 to 6 did not change anything.

Steps To Reproduce

I would like to provide a simple example, I will provide one as soon as I , find the time to Build one.

Exceptions (if any)

Unable to connect to the server with any of the available transports. (WebSockets failed: Unable to connect to the remote server) (LongPolling failed: The transport is disabled by the client.)

.NET Version

6

Anything else?

No response

@javiercn javiercn added the area-signalr Includes: SignalR clients and servers label May 25, 2022
@BrennanConroy
Copy link
Member

if I connect to an non signalR Websocket I with System.Net.WebSockets, everithing is working as intendet.

SignalR uses System.Net.WebSockets so there shouldn't be any difference in behavior here.

Can you share how are you using System.Net.WebSockets outside of SignalR? Also, capture client and server logs please: https://docs.microsoft.com/aspnet/core/signalr/diagnostics?view=aspnetcore-6.0

@BrennanConroy BrennanConroy added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label May 25, 2022
@ghost
Copy link

ghost commented May 25, 2022

Hi @SSpormann. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@SSpormann
Copy link
Author

@BrennanConroy
So, if I use Websockets as only transport, I get the above mentioned error,
Unable to connect to the server with any of the available transports. (WebSockets failed: Unable to connect to the remote server) (LongPolling failed: The transport is disabled by the client.)
And no Log on the server side, this seems to me like signalr is preventing the use of websockets by it self.

If I allow longpolling I get,
[Authorization, Bearer sometoken] [Host, myhost] [User-Agent, Microsoft SignalR/6.0 (6.0.3+c911002ab43b7b989ed67090f2a48d9073d5118d; Linux; .NET; Mono 6.12.0 (2020-02/adf1bc4335d))] [x-requested-with, XMLHttpRequest] [x-forwarded-proto, https] 2022-05-27 08:04:48.4049||DEBUG|AuthService.AuthenticationHandlers.EpasAuthenticationHandler|Bypassing auth for /myHub: /myHub 2022-05-27 08:04:48.4049|8|DEBUG|AuthService.AuthenticationHandlers.EpasAuthenticationHandler|AuthenticationScheme: EpasAuth was successfully authenticated. 2022-05-27 08:04:48.4094|4|DEBUG|Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionDispatcher|Establishing new connection. 2022-05-27 08:04:48.4094|5|DEBUG|Microsoft.AspNetCore.SignalR.HubConnectionHandler|OnConnectedAsync started.

And the connection is working, from here on.

I used this example to validate that the concept should in theory work,

https://devblogs.microsoft.com/xamarin/developing-real-time-communication-apps-with-websocket/

(You will have to Update some/all nuget packages to make it work)

Maybe it has something to do with teh setup of my project, the client is currently in a netstandard 2.1 project that I referenced in my project, beacause we are using the same client on multiple platforms.

If I use the same client under WPF, with only transport Websocket, every thing works fine.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels May 27, 2022
@SSpormann
Copy link
Author

I can now provide a sample that shows a working version with playn websockets, and a version that is working with signalr Longpolling enabled and is not working with signalr only using websockets on the client side.

You can finde the project here:

If you prefere an other methode to recieve the sample please, contact me we can figure something out.

To use the sample there is a solution under the folder easychat, there should be two Xamarin projects inside, one is called MyEasyChat, this is using plain websockets, combine this project with the server in the folder myeasychat und you can see that the concept of using websockets with System.Net.WebSockets does work. If you now want to try the faulty projekt, you have to use the project SignalRMyEasyChat under the EasyChat.sln and combine this with the myeasychat-signalr server under the folder with tehe same name(myeasychat-signalr) this, should currently promt the same error as I provided earlier.

Unable to connect to the server with any of the available transports. (WebSockets failed: Unable to connect to the remote server) (LongPolling failed: The transport is disabled by the client.)

if you now change the line of code in the EasyChat.sln -> SignalRMyEasyChat -> ChatPageViewModel line: 41

From:
opts.Transports = Microsoft.AspNetCore.Http.Connections.HttpTransportType.WebSockets /*| Microsoft.AspNetCore.Http.Connections.HttpTransportType.ServerSentEvents | Microsoft.AspNetCore.Http.Connections.HttpTransportType.LongPolling*/;

To:
opts.Transports = Microsoft.AspNetCore.Http.Connections.HttpTransportType.WebSockets | Microsoft.AspNetCore.Http.Connections.HttpTransportType.ServerSentEvents | Microsoft.AspNetCore.Http.Connections.HttpTransportType.LongPolling;

you should see that Signal-R is indeed working, but it does not work with websockets as transport.

you will have to change the IP-Adresses, in the ChatPageViewModel files, to your Server-IP.

I would investigate this problem further by my self but, currently I have no Idea how to setup the aspnet core repository in a way, that I would be able to debug this problem, I tried to setup a debug environment a year ago and stoped trying after 2 days. If someone has a guide on how to debug the aspnet.core project that would help me out a great deal.

I allso tryed to capture network traffic, from the phone to the server and as I suspected earlier, there is not even a connection request exiting the device, so I belive ther must be a logic error that throws the exception client side.

@BrennanConroy
Copy link
Member

Please provide the repro app as a github repository.

@SSpormann
Copy link
Author

@BrennanConroy here you go.

@davidfowl
Copy link
Member

davidfowl commented May 30, 2022

@SSpormann is it private? It says not found.

@SSpormann
Copy link
Author

@BrennanConroy sorry should be public now

@davidfowl
Copy link
Member

Unrelated: https://github.com/SSpormann/EasyChat-SignalR/blob/afb56ae1a2b5c00a2d8d4f445688c7f6a3012772/myeasychat-signalr/myeasychat-signalr/Program.cs#L15

Why would you allow the client to send a message of 1GB? That's a potential security issue.

@davidfowl
Copy link
Member

Also unrelated, sent a clean up PR SSpormann/EasyChat-SignalR#1

@davidfowl
Copy link
Member

@SSpormann can you remove specifying all of the transports from both the client and server?

@SSpormann
Copy link
Author

@davidfowl No thats the point of the sample, i want to use websocket transport, if i use longpolling it works, and if I remove the Settings from the client it falls back to longpolling

@davidfowl
Copy link
Member

WebSockets is used by default, when nothing is specified. We're trying to understand why that isn't happening in this case.

@SSpormann
Copy link
Author

So if i remove the transport overwrite from both, the client and the server it defaults to server sent events

trce: Microsoft.AspNetCore.SignalR.HubConnectionContext[3]
      Sent a ping message to the client.
trce: Microsoft.AspNetCore.Http.Connections.Internal.Transports.ServerSentEventsTransport[1]

@davidfowl
Copy link
Member

Great, so it's explicitly always skipping websockets. What server are you running this on?

@SSpormann
Copy link
Author

In testing I use a Windows 10 mashine, but in production we use Ubuntu 20.04 lts and it shows the same behavior

@davidfowl
Copy link
Member

Those are wildly different OSes, so before debugging, we should pick the relevant one and the one you have access to. Though since it happens on both I wonder if this is a client problem more than a server one.

What do the server side logs show when you try to connect?

@SSpormann
Copy link
Author

SSpormann commented May 30, 2022

As I mentioned earlyer in the post, I head a suspicion that this is a client problem if I define only Websocket transport on the client I don't get a request on the server, I allso tried to log the network traffic, but there was no request on the signalr port, so I figured the client side must have prevented the execution of the request.

so if I dont configure transport, I get

trce: Microsoft.AspNetCore.SignalR.HubConnectionContext[3]
      Sent a ping message to the client.
trce: Microsoft.AspNetCore.Http.Connections.Internal.Transports.ServerSentEventsTransport[1]

If I do, specify websockets, I dont get anything.

@davidfowl
Copy link
Member

This is the only thing that comes to mind

Log.TransportNotSupported(_loggerFactory.CreateLogger<DefaultTransportFactory>(), HttpTransportType.WebSockets, ex);
.

How easily can you debug first chance exceptions in Xamarin applications?

@davidfowl
Copy link
Member

Does console logging work with Xamarin android? If yes, you should be able to use this package to add the console logger to the hubconnectionbuilder

@SSpormann
Copy link
Author

I never tried this, without putting the source directly into my solution, but I dont know if i could link the pdb of the asp signalr project, this might work.

Yes the overwrite logging should work.

@davidfowl
Copy link
Member

davidfowl commented May 30, 2022

@SSpormann Lets go with the client side logging for now. That should suffice.

@SSpormann
Copy link
Author

This is unconfigured
Loaded assembly: /data/data/com.companyname.signalrmyeasychat/files/.__override__/System.Net.Http.dll [External] Loaded assembly: /data/data/com.companyname.signalrmyeasychat/files/.__override__/System.Memory.dll [External] Loaded assembly: /data/data/com.companyname.signalrmyeasychat/files/.__override__/System.Buffers.dll [External] Thread started: Console logger queue processing thread #2 Resolved pending breakpoint at 'ChatPageViewModel.cs:97,1' to void SignalRMyEasyChat.ChatPageViewModel.<ConnectToServerAsync>d__16.MoveNext () [0x000f8]. Resolved pending breakpoint at 'ChatPageViewModel.cs:92,1' to void SignalRMyEasyChat.ChatPageViewModel.<ConnectToServerAsync>d__16.MoveNext () [0x0004a]. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[40] Registering handler for client method 'send'. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[42] Waiting on Connection Lock in StartAsyncInner (/_/src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs:247). <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[80] The HubConnection is attempting to transition from the Disconnected state to the Connecting state. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[41] Starting HubConnection. <7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[1] Starting HttpConnection. <7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[8] Establishing connection with server at 'https://172.31.20.12:5001/EasyChatHub?deviceId=25a005e58875bbfa'. Thread started: #3 <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.LoggingHttpMessageHandler[1] Sending HTTP request POST 'https://172.31.20.12:5001/EasyChatHub/negotiate?deviceId=25a005e58875bbfa&negotiateVersion=1'. Thread started: <Thread Pool> #4 Thread started: <Thread Pool> #5 Thread started: <Thread Pool> #6 Thread started: <Thread Pool> #7 Thread started: <Thread Pool> #8 Thread started: <Thread Pool> #9 [Looper] PerfMonitor longMsg : seq=58 plan=08:46:42.695 late=16ms wall=6800ms running=706ms runnable=21ms binder=2ms h=android.view.ViewRootImpl$ViewRootHandler c=android.view.View$PerformClick procState=2 [Choreographer] Skipped 407 frames! The application may be doing too much work on its main thread. [Looper] PerfMonitor doFrame : time=10ms vsyncFrame=797025 latency=6797ms procState=2 historyMsgCount=4 (msgIndex=1 wall=6800ms seq=58 running=706ms runnable=21ms binder=2ms late=16ms h=android.view.ViewRootImpl$ViewRootHandler c=android.view.View$PerformClick) [OpenGLRenderer] Davey! duration=6831ms; Flags=0, IntendedVsync=24365372127998, Vsync=24372155461060, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=24372169461587, AnimationStart=24372169465857, PerformTraversalsStart=24372169765180, DrawStart=24372176263722, SyncQueued=24372178766118, SyncStart=24372179458357, IssueDrawCommandsStart=24372179527368, SwapBuffers=24372203024191, FrameCompleted=24372204327368, DequeueBufferDuration=243490, QueueBufferDuration=458073, GpuCompleted=0, Thread started: <Thread Pool> #10 Thread started: <Thread Pool> #11 Loaded assembly: /data/data/com.companyname.signalrmyeasychat/files/.__override__/System.Numerics.Vectors.dll [External] Loaded assembly: /data/data/com.companyname.signalrmyeasychat/files/.__override__/System.Runtime.CompilerServices.Unsafe.dll [External] <7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[9] Established connection 'njSkUc0x9n2uwiOpCtGhnw' with the server. <7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[7] Starting transport 'WebSockets' with Url: https://172.31.20.12:5001/EasyChatHub?deviceId=25a005e58875bbfa. <6>Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport[1] Starting transport. Transfer mode: Text. Url: 'wss://172.31.20.12:5001/EasyChatHub?deviceId=25a005e58875bbfa&id=YH4JQg3nM4uhdlEVbcXbHw'. <3>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[11] Failed to start connection. Error starting transport 'WebSockets'. System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/boringssl/ssl/handshake_client.c:1132 at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00042] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Btls/MonoBtlsContext.cs:220 at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:715 at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus,bool) at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:289 at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:223 --- End of inner exception stack trace --- at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono.Net.Security.MonoSslAuthenticationOptions options, System.Threading.CancellationToken cancellationToken) [0x0025c] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:310 at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x0014f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs:106 at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x00385] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs:150 at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken) [0x000d1] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocket.cs:157 at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.DefaultWebSocketFactory (Microsoft.AspNetCore.Http.Connections.Client.WebSocketConnectionContext context, System.Threading.CancellationToken cancellationToken) [0x003a7] in <d026f2adb6344ee59c6b7ee83a4fa858>:0 at System.Threading.Tasks.ValueTask1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.StartAsync (System.Uri url, Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00119] in :0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartTransport (System.
<7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[15] Skipping transport WebSockets because it failed to initialize. System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/boringssl/ssl/handshake_client.c:1132 at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00042] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Btls/MonoBtlsContext.cs:220 at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:715 at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus,bool) at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:289 at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:223 --- End of inner exception stack trace --- at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono.Net.Security.MonoSslAuthenticationOptions options, System.Threading.CancellationToken cancellationToken) [0x0025c] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:310 at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x0014f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs:106 at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x00385] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs:150 at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken) [0x000d1] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocket.cs:157 at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.DefaultWebSocketFactory (Microsoft.AspNetCore.Http.Connections.Client.WebSocketConnectionContext context, System.Threading.CancellationToken cancellationToken) [0x003a7] in :0 at System.Threading.Tasks.ValueTask1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.StartAsync (System.Uri url, Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00119] in <d026f2adb6344ee59c6b7ee83a4fa858>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartTransport (System.Uri <7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[8] Establishing connection with server at 'https://172.31.20.12:5001/EasyChatHub?deviceId=25a005e58875bbfa'. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.LoggingHttpMessageHandler[1] Sending HTTP request POST 'https://172.31.20.12:5001/EasyChatHub/negotiate?deviceId=25a005e58875bbfa&negotiateVersion=1'. <7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[9] Established connection 'FC86Tlr0WfCGY6rbEfZ4SQ' with the server. <7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[7] Starting transport 'ServerSentEvents' with Url: https://172.31.20.12:5001/EasyChatHub?deviceId=25a005e58875bbfa. <6>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[1] Starting transport. Transfer mode: Text. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.LoggingHttpMessageHandler[1] Sending HTTP request GET 'https://172.31.20.12:5001/EasyChatHub?deviceId=25a005e58875bbfa&id=Mzpn-gh-t9OxVaZM2ENdUA'. Loaded assembly: /data/data/com.companyname.signalrmyeasychat/files/.__override__/System.Threading.Tasks.Extensions.dll [External] <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[3] Starting receive loop. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 3 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[100] Starting the send loop. <7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[18] Transport 'ServerSentEvents' started. <6>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[3] HttpConnection Started. <6>Microsoft.AspNetCore.SignalR.Client.HubConnection[24] Using HubProtocol 'json v1'. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[28] Sending Hub Handshake. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[103] Sending 32 bytes to the server using url: https://172.31.20.12:5001/EasyChatHub?deviceId=25a005e58875bbfa&id=Mzpn-gh-t9OxVaZM2ENdUA. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.LoggingHttpMessageHandler[1] Sending HTTP request POST 'https://172.31.20.12:5001/EasyChatHub?deviceId=25a005e58875bbfa&id=Mzpn-gh-t9OxVaZM2ENdUA'. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[104] Message(s) sent successfully. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 6 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 9 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 11 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 2 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[7] Passing message to application. Payload size: 3. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[39] Handshake with server complete. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[59] Sending PingMessage message. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[103] Sending 11 bytes to the server using url: https://172.31.20.12:5001/EasyChatHub?deviceId=25a005e58875bbfa&id=Mzpn-gh-t9OxVaZM2ENdUA. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.LoggingHttpMessageHandler[1] Sending HTTP request POST 'https://172.31.20.12:5001/EasyChatHub?deviceId=25a005e58875bbfa&id=Mzpn-gh-t9OxVaZM2ENdUA'. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[60] Sending PingMessage message completed. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[47] Receive loop starting. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[104] Message(s) sent successfully. <6>Microsoft.AspNetCore.SignalR.Client.HubConnection[44] HubConnection started. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[80] The HubConnection is attempting to transition from the Connecting state to the Connected state. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[20] Releasing Connection Lock in StartAsyncInner (/_/src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs:280). <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 6 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 17 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 19 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 2 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[7] Passing message to application. Payload size: 11. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[56] Processing 11 byte message from server. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[26] Resetting keep-alive timer, received a message from the server. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[31] Received a ping message. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 6 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 17 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 19 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[9] Received 2 bytes. Parsing SSE frame. <7>Microsoft.AspNetCore.Http.Connections.Client.Internal.ServerSentEventsTransport[7] Passing message to application. Payload size: 11. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[56] Processing 11 byte message from server. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[26] Resetting keep-alive timer, received a message from the server. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[31] Received a ping message.

this is configured with websockets only
<7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[9] Established connection '5rvTPvZvxlok8Ex2-ngYCw' with the server. <7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[7] Starting transport 'WebSockets' with Url: https://172.31.20.12:5001/EasyChatHub?deviceId=25a005e58875bbfa. <6>Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport[1] Starting transport. Transfer mode: Text. Url: 'wss://172.31.20.12:5001/EasyChatHub?deviceId=25a005e58875bbfa&id=TI2rtRdNFM-sQE_hy8h0Eg'. <3>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[11] Failed to start connection. Error starting transport 'WebSockets'. System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/boringssl/ssl/handshake_client.c:1132 at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00042] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Btls/MonoBtlsContext.cs:220 at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:715 at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus,bool) at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:289 at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:223 --- End of inner exception stack trace --- at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono.Net.Security.MonoSslAuthenticationOptions options, System.Threading.CancellationToken cancellationToken) [0x0025c] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:310 at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x0014f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs:106 at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x00385] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs:150 at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken) [0x000d1] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocket.cs:157 at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.DefaultWebSocketFactory (Microsoft.AspNetCore.Http.Connections.Client.WebSocketConnectionContext context, System.Threading.CancellationToken cancellationToken) [0x003a7] in <d026f2adb6344ee59c6b7ee83a4fa858>:0 at System.Threading.Tasks.ValueTask1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.StartAsync (System.Uri url, Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00119] in :0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartTransport (System.
<7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[15] Skipping transport WebSockets because it failed to initialize. System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/boringssl/ssl/handshake_client.c:1132 at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00042] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Btls/MonoBtlsContext.cs:220 at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:715 at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus,bool) at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:289 at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:223 --- End of inner exception stack trace --- at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono.Net.Security.MonoSslAuthenticationOptions options, System.Threading.CancellationToken cancellationToken) [0x0025c] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:310 at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x0014f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs:106 at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x00385] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs:150 at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken) [0x000d1] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocket.cs:157 at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.DefaultWebSocketFactory (Microsoft.AspNetCore.Http.Connections.Client.WebSocketConnectionContext context, System.Threading.CancellationToken cancellationToken) [0x003a7] in :0 at System.Threading.Tasks.ValueTask1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.StartAsync (System.Uri url, Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00119] in <d026f2adb6344ee59c6b7ee83a4fa858>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartTransport (System.Uri <7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[14] Skipping transport ServerSentEvents because it was disabled by the client. <7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[14] Skipping transport LongPolling because it was disabled by the client. <7>Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[5] Skipping dispose, connection is already disposed. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[80] The HubConnection is attempting to transition from the Connecting state to the Disconnected state. <7>Microsoft.AspNetCore.SignalR.Client.HubConnection[20] Releasing Connection Lock in StartAsyncInner (/_/src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs:280). Signalr connect failed System.AggregateException: Unable to connect to the server with any of the available transports. (WebSockets failed: Unable to connect to the remote server) (ServerSentEvents failed: The transport is disabled by the client.) (LongPolling failed: The transport is disabled by the client.) ---> Microsoft.AspNetCore.Http.Connections.Client.TransportFailedException: WebSockets failed: Unable to connect to the remote server ---> System.Net.WebSockets.WebSocketException: Unable to connect to the remote server ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/boringssl/ssl/handshake_client.c:1132 at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00042] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Btls/MonoBtlsContext.cs:220 at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:715 at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus,bool) at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:289 at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:223 --- End of inner exception stack trace --- at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono.Net.Security.MonoSslAuthenticationOptions options, System.Threading.CancellationToken cancellationToken) [0x0025c] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:310 at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x0014f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs:106 --- End of inner exception stack trace --- at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x00385] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs:150 at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken) [0x000d1] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocket.cs:157 at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.DefaultWebSocketFactory (Microsoft.AspNetCore.Http.Connections.Client.WebSocketConnectionContext context, System.Threading.CancellationToken cancellationToken) [0x003a7] in <d026f2adb6344ee59c6b7ee83a4fa858>:0 at System.Threading.Tasks.ValueTask1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813
at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.StartAsync (System.Uri url, Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00119] in :0
at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartTransport (System.Uri connectUrl, Microsoft.AspNetCore.Http.Connections.HttpTransportType transportType, Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x000ba] in :0
at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.SelectAndStartTransport (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x004ff] in :0
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.SelectAndStartTransport (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x005b2] in :0
at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsyncCore (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00127] in :0
at System.Threading.Tasks.ForceAsyncAwaiter.GetResult () [0x0000c] in :0
at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsync (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00091] in :0
at Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync (System.Net.EndPoint endPoint, System.Threading.CancellationToken cancellationToken) [0x00114] in :0
at Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync (System.Net.EndPoint endPoint, System.Threading.CancellationToken cancellationToken) [0x001bf] in :0
at System.Threading.Tasks.ValueTask1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncCore (System.Threading.CancellationToken cancellationToken) [0x000a9] in <fe6fb5de191d46d2bb2adcc855b27710>:0 at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncInner (System.Threading.CancellationToken cancellationToken) [0x001a3] in <fe6fb5de191d46d2bb2adcc855b27710>:0 at System.Threading.Tasks.ForceAsyncAwaiter.GetResult () [0x0000c] in <fe6fb5de191d46d2bb2adcc855b27710>:0 at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsync (System.Threading.CancellationToken cancellationToken) [0x00091] in <fe6fb5de191d46d2bb2adcc855b27710>:0 at SignalRMyEasyChat.ChatPageViewModel.ConnectToServerAsync () [0x00069] in C:\Users\sspormann\Desktop\easychat-service\EasyChat-SignalR\SignalRMyEasyChat\SignalRMyEasyChat\ChatPageViewModel.cs:92 ---> (Inner Exception #0) Microsoft.AspNetCore.Http.Connections.Client.TransportFailedException: WebSockets failed: Unable to connect to the remote server ---> System.Net.WebSockets.WebSocketException: Unable to connect to the remote server ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/boringssl/ssl/handshake_client.c:1132 at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00042] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Btls/MonoBtlsContext.cs:220 at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:715 at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus,bool) at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:289 at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:223 --- End of inner exception stack trace --- at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono.Net.Security.MonoSslAuthenticationOptions options, System.Threading.CancellationToken cancellationToken) [0x0025c] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:310 at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x0014f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs:106 --- End of inner exception stack trace --- at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x00385] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs:150 at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken) [0x000d1] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocket.cs:157 at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.DefaultWebSocketFactory (Microsoft.AspNetCore.Http.Connections.Client.WebSocketConnectionContext context, System.Threading.CancellationToken cancellationToken) [0x003a7] in <d026f2adb6344ee59c6b7ee83a4fa858>:0 at System.Threading.Tasks.ValueTask1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813
at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.StartAsync (System.Uri url, Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00119] in :0
at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartTransport (System.Uri connectUrl, Microsoft.AspNetCore.Http.Connections.HttpTransportType transportType, Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x000ba] in :0
at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.SelectAndStartTransport (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x004ff] in :0
--- End of inner exception stack trace ---<---
---> (Inner Exception #1) Microsoft.AspNetCore.Http.Connections.Client.TransportFailedException: ServerSentEvents failed: The transport is disabled by the client.<---
---> (Inner Exception #2) Microsoft.AspNetCore.Http.Connections.Client.TransportFailedException: LongPolling failed: The transport is disabled by the client.<---
[Choreographer] Skipped 52 frames! The application may be doing too much work on its main thread.`

@davidfowl
Copy link
Member

Seems like HTTPS is the problem? The error is right there:

Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[11] Failed to start connection. Error starting transport 'WebSockets'. 
System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server ---> 
System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> 
Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/boringssl/ssl/handshake_client.c:1132 at 
Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00042] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Btls/MonoBtlsContext.cs:220 at 
Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:715 at (wrapper remoting-invoke-w

@SSpormann
Copy link
Author

Yes i have seen the error, but the same seems to work with ather transports they should in theory use the same implementation of SSL as longpolling and serversendevents, but this must than be an issue of googles boringssl.

@davidfowl
Copy link
Member

davidfowl commented May 30, 2022

Try adding this to your client configuration:

opts.WebSocketConfiguration = o =>
{
    o.RemoteCertificateValidationCallback = (a, b, c, d) =>
    {
        return true;
    };
};

https://github.com/SSpormann/EasyChat-SignalR/blob/bd3d734da4fa378fbb93302bbbc3c14c289617b2/SignalRMyEasyChat/SignalRMyEasyChat/ChatPageViewModel.cs#L33

OR you can use HTTP instead of HTTPS.. 😄

@SSpormann
Copy link
Author

@BrennanConroy I tryed that before, It does work if you dissable SSL but it did work without SSL before, and not using encryption is not a vallid solution for production.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity labels Jul 25, 2022
@jpobst
Copy link

jpobst commented Aug 4, 2022

If your repro is small enough to translate, you might want to try it as a net6.0-android app and see if it works.

The sockets layer was completely rewritten for .NET 6 Android and is now much closer to the rest of .NET. It might help narrow down which component is causing issues.

@rafikiassumani-msft rafikiassumani-msft added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Aug 9, 2022
@ghost
Copy link

ghost commented Aug 9, 2022

Hi @SSpormann. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@davidfowl
Copy link
Member

@ghost
Copy link

ghost commented Aug 15, 2022

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.

@SSpormann
Copy link
Author

@davidfowl i have tried this, not on maui, it does not help.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity labels Aug 15, 2022
@SSpormann
Copy link
Author

@jpobst i might consider rewriting the sample application, but currently i dont have the time to convert the production app to maui, and in the current state of the maui project I'am hesetant to do so in production.

@captainsafia captainsafia added the External This is an issue in a component not contained in this repository. It is open for tracking purposes. label Aug 16, 2022
@halter73
Copy link
Member

halter73 commented Aug 16, 2022

Triage notes: We think the support for self-signed certs for WebSocket and gRPC (because of HTTP/2? @JamesNK) on android might be lacking. It is interesting that "normal" long polling and SSE requests still worked.

Edit: Is this multiple issues? What about publicly signed certs? What CA list does SslStream use on Android by default? It doesn't look like we're using OpenSSL like we would on a conventional Linux distro. Context: dotnet/runtime#45741

@SSpormann
Copy link
Author

@halter73 I have the same scenario in production with Letsencrypt certificates, so I dont think this is nescessarily the problem.

@halter73
Copy link
Member

dotnet/runtime#74292 is another issue dealing with TLS problems on Android.

@rafikiassumani-msft rafikiassumani-msft added investigate and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Sep 6, 2022
@rafikiassumani-msft rafikiassumani-msft added this to the .NET 8 Planning milestone Sep 13, 2022
@ghost
Copy link

ghost commented Sep 13, 2022

Thanks for contacting us.
We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. Because it's not immediately obvious that this is a bug in our framework, we would like to keep this around to collect more feedback, which can later help us determine the impact of it. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@ekeneduru
Copy link

My xamarin app was working for a while now but after i upgraded ,Net 6 on the server. Then this error started happening.

Unable to connect to the server with any of the available transports. (WebSockets failed: Unable to connect to the remote server) (ServerSentEvents failed: Response status code does not indicate success: 404 (Not Found).) (LongPolling failed: Response status code does not indicate success: 404 (Not Found).)

@SSpormann
Copy link
Author

SSpormann commented Jan 26, 2023

So i finally came arround to convert my existing production app to MAUI and lo and behold the issue is resolved and my project works as excpected and predicted by @jpobst

I consider this problem solved.

@ghost ghost locked as resolved and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-signalr Includes: SignalR clients and servers External This is an issue in a component not contained in this repository. It is open for tracking purposes. investigate
Projects
None yet
Development

No branches or pull requests