HttpConnectionContext.TickHeartbeat() in SignalR ticks after the context is disposed, causing runtime errors when accessing context from heartbeat handlers
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
HubCallerContext is already disposed, its getter throws an error instead of doing anything useful (like returning a context where someone could check if it's disposed before trying to use it). When users attach OnHeartbeat handlers, I think it's fair to expect that the framework will stop calling them once the session is disposed. However, it seems like sometimes the heartbeats continue after this point, and this generates runtime errors because who wraps their property access attempts in a try/catch.

### Expected Behavior
Heartbeat handlers are no longer called after session dispose, or accessor does not throw an error and Context has a property that devs can check themselves.
### Steps To Reproduce
_No response_
### Exceptions (if any)
_No response_
### .NET Version
_No response_
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.