SteamRE / SteamKit

SteamKit2 is a .NET library designed to interoperate with Valve's Steam network. It aims to provide a simple, yet extensible, interface to perform various actions on the network.
GNU Lesser General Public License v2.1
2.62k stars 497 forks source link

Handle CMClient.OnClientConnected() throwing (probably from a derived class) #1430

Closed yaakov-h closed 2 months ago

yaakov-h commented 2 months ago

When playing around with NativeAOT, this can easily throw an exception as this is the first point at which we touch protobuf serialization, particularly when working with websockets.

At the moment this exception gets captured in the WebSocketContext task and does not get printed to DebugLog, so the program has the appearance of hanging.

This prints the exception to DebugLog and then triggers a non-user-initiated Disconnect call to close the connection, rather than just hanging forever on an open connection that we cannot do anything with.