You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
I've found that in some cases exceptions that are caught in HubConnection aren't propagated to TaskCompletionSource, thus Task never ends.
For example, if some serialization IProtocol fires an exception, it is caught in method SendMessage of a HubConnection and sent to log without any notification to the upper systems. The only way users can handle such a situation is to pass some CancellationToken with timeout to InvokeAsync or SendAsync methods.
Also, I've noticed that CancellationToken that is passed to InvokeAsync or SendAsync methods is not passed to TrySetCanceled method in the cancellationToken.Register call. In this case it is impossible to implement some logic based on cancellation tokens.
The text was updated successfully, but these errors were encountered:
Scormave
changed the title
There is no exception propagation to TaskCompletionSource in some cases
There is no exception propagation to TaskCompletionSource in some cases. And CancellationToken is not passed to TrySetCanceled.
May 15, 2023
That's funny, I've made exactly the same changes locally to get everything work. But, are you sure that it is safe to throw exception from SendMessage for all code paths? I've added throw only for specific code paths, which go from InvokeAsync and SendAsync.
Added two additional cases catching the exception, but i think it's going to be OK. If not in the HubConnection then they will be catched and logged in the transport layer, but they will not cause any serious issue.
Hi!
I've found that in some cases exceptions that are caught in HubConnection aren't propagated to TaskCompletionSource, thus Task never ends.
For example, if some serialization IProtocol fires an exception, it is caught in method SendMessage of a HubConnection and sent to log without any notification to the upper systems. The only way users can handle such a situation is to pass some CancellationToken with timeout to InvokeAsync or SendAsync methods.
Also, I've noticed that CancellationToken that is passed to InvokeAsync or SendAsync methods is not passed to TrySetCanceled method in the cancellationToken.Register call. In this case it is impossible to implement some logic based on cancellation tokens.
The text was updated successfully, but these errors were encountered: