Skip to content

SignalR .NET client restart failed with "The HubConnection cannot be started while StopAsync is running" #18028

Closed
@dlyz

Description

@dlyz

Describe the bug

I'm using .NET SignalR Client. After connection breaks I invoke await connection.StopAsync() and then await connection.StartAsync(). StartAsync throws InvalidOperationException: "The HubConnection cannot be started while StopAsync is running". The super easy way to reproduce it is to create a connection, invoke await connection.StopAsync() and then await connection.StartAsync(). After that the connection can never be started.

It looks like a bug. I looked at the code and it seems that StopAsyncCore cancels the cts, but never directly recreates it.

Further technical details

  • ASP.NET Core 3.1

Metadata

Metadata

Assignees

Labels

area-signalrIncludes: SignalR clients and serversbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions