From e4f2f9a2fe35572f8c9a916b2aea14aae2b24ebf Mon Sep 17 00:00:00 2001 From: Harish Date: Fri, 27 Sep 2019 17:52:49 +0800 Subject: [PATCH] Handling unhandled exception "You cannot set LocalEdnPoint after you start the connection." occurs when connection closed called (By some internal code) For detailed error check the below issue https://github.com/kerryjiang/SuperSocket.ClientEngine/issues/107 --- Core/ClientSession.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Core/ClientSession.cs b/Core/ClientSession.cs index 63366ff..2f68fca 100644 --- a/Core/ClientSession.cs +++ b/Core/ClientSession.cs @@ -119,7 +119,14 @@ public event EventHandler Closed protected virtual void OnClosed() { IsConnected = false; - LocalEndPoint = null; + try + { + LocalEndPoint = null; + } + catch (Exception ex) + { + OnError(ex); + } var handler = m_Closed;