Cysharp / MagicOnion

Unified Realtime/API framework for .NET platform and Unity.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unhandleable exceptions when connecting

AdamFrisby opened this issue · comments

StreamingHubClientBase.cs has multiple locations where it traps exceptions, and by default, silently eats them; preventing them being handled appropriately.

StartSubscribe() (line circa 139 and circa 161) can receive RpcExceptions and other faults when a connection fails; however due to it silently eating these at this point, it becomes impossible to know whether a connection is alive or dead; particularly in the case of a unidirectional StreamingHub where the client only receives messages from the server.

This is compounded by NullLogger being the default, which eats the log messages informing of the fault, leading to an undetectable state where a connection has failed, but no errors are reported.

Whether a StreamingHub connection has been established can be determined by whether ConnectAsync throws an exception. If the connection is disconnected while receiving a message, you can handle it by waiting for WaitForDisconnect.

When an exception thrown by await moveNext (in StartSubscribe) are caught, the subscription is stopped and signalled to WaitForDisconnect.

We are considering passing the cause of the error to WaitForDisconnect. Would that be insufficient?

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.