dotnet / dotnet/aspnetcore

[SignalR] Client keepalive check is disabled when I debug my hub server

Open
#41,673 18 comments 1 reaction 0 assignees View on GitHub
area-signalr
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

Client ping timeout check is disabled when I debug my hub server

### Expected Behavior

I should be able to see `OnDisconnectedAsync` triggered when client does not send out ping messages

### Steps To Reproduce

1. Create a simple Hub server
2. Shorten `ClientTimeoutInterval` to 5 seconds: `services.AddSignalR(o=>o.ClientTimeoutInterval=TimeSpan.FromSeconds(5));`
3. Override OnDisconnectedAsync in the hub and insert a breakpoint there
4. F5 to start debugging my hub
5. OnDisconnectedAsync is never triggered because KeepAlive check is disabled when Debugger is attached: https://github.com/dotnet/aspnetcore/blob/88ee825bca9978df7f1d8c8c09b71b6dffeeb53b/src/SignalR/server/Core/src/HubConnectionContext.cs#L656

### Exceptions (if any)

_No response_

### .NET Version

6.0.203

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.