Skip to content

SignalR WebSocket exception when upgrading to latest System.Collections.Immutable library #24998

@jc1001

Description

@jc1001

Describe the bug

I have a .NET Core 2 application that is targeting the full .NET Framework (v4.8).
It hosts a web server (using HttpSys) that exposes a SignalR hub.
I can make a successful call from a client (in this case a .NET console application) to the SignalR hub.

When I upgrade the System.Collections.Immutable library on the server to v1.7.1, the connection call from the client application to the SignalR hub on the server fails with a WebSocketException.

To Reproduce

I have attached a sample solution that reproduces the problem.
SignalRBug.zip

The solution contains 2 projects: "Client" and "Server".
An instance of "Server" must be running (hosting on http://localhost:8080) before you can execute "Client".
The example (as attached) will run without any errors.

When you edit the Server.csproj file to include the latest version of the System.Collections.Immutable library, the client application will fail as described above.

Exceptions (if any)

WebSocketException
WebSocketException

Message: The remote party closed the WebSocket connection without completing the close handshake.
Stack trace:

   at System.Net.WebSockets.WebSocketBase.WebSocketOperation.<Process>d__19.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.WebSockets.WebSocketBase.<ReceiveAsyncCore>d__45.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.<StartReceiving>d__19.MoveNext()
   at System.IO.Pipelines.PipeCompletion.ThrowLatchedException()
   at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result)
   at System.IO.Pipelines.Pipe.GetReadAsyncResult()
   at System.IO.Pipelines.Pipe.DefaultPipeReader.GetResult(Int16 token)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at Microsoft.AspNetCore.SignalR.Client.HubConnection.<HandshakeAsync>d__61.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.SignalR.Client.HubConnection.<StartAsyncCore>d__47.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.SignalR.Client.HubConnection.<StartAsyncCore>d__47.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.SignalR.Client.HubConnection.<StartAsync>d__39.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Client.Program.<Main>d__0.MoveNext() in D:\Temp\SignalRBug\Client\Program.cs:line 17

Further technical details

  • .NET Framework 4.8
  • Microsoft Visual Studio Enterprise 2019, Version 16.7.1
  • Windows 10, version 2004 (Build: 19041.450)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-signalrIncludes: SignalR clients and servers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions