ig-memtrace icon indicating copy to clipboard operation
ig-memtrace copied to clipboard

SocketException thrown

Open gjaegy opened this issue 5 years ago • 1 comments
trafficstars

I've used memtrace yesterday again, after a while not using it.

I encountered issue where the GUI was crashing as soon as I exited our application. Every single time, leading to a corrupted trace file.

After investigation, I found out the issue came from an exception being thrown on the GUI side, once the socket was closed on the application side. This exception was not caught, hence the crash.

This occured in TraceRecorder.cs, line 138, during the following call: m_Socket.BeginReceive(m_Buffer, 0, m_Buffer.Length, SocketFlags.None, OnDataRead, null);

Replacing the line above with the following block solved my problem and resulted in valid trace files: try { m_Socket.BeginReceive(m_Buffer, 0, m_Buffer.Length, SocketFlags.None, OnDataRead, null); } catch (SocketException ex) { Debug.WriteLine("Exception: {0}", ex.Message); OnEndOfInput(); }

I'm not sure however why that exception suddenly appeared (we haven't changed anything). Possibly a change at the VS/C# level, or OS ? Haven't investigated further...

gjaegy avatar Feb 05 '20 08:02 gjaegy

Please check the remark in my pull request for an explanation of why this occured...

gjaegy avatar Feb 06 '20 16:02 gjaegy