private static unsafe void _LogMessageReqArgsAndException(object reqArgs, MessagingUnhandledExceptionEventArgs e) { Debug.Assert(reqArgs != null); Debug.Assert(e != null && e.ExceptionObject != null && e.Buffer != null); string message_type = "unknown message"; if (reqArgs is AsynReqArgs) { message_type = "asynchronous message"; } if (reqArgs is SynReqArgs) { message_type = "synchronous message"; } if (reqArgs is SynReqRspArgs) { message_type = "synchronous message (with RSP request)"; } Log.WriteLine(LogLevel.Error, "Exceptions are caught in the handler of {0}, message sn: {1}", message_type, e.Buffer[TrinityProtocol.MsgIdOffset]); Log.WriteLine(LogLevel.Error, e.ExceptionObject.Message); Log.WriteLine(LogLevel.Error, e.ExceptionObject.StackTrace); Log.WriteLine(LogLevel.Error, "Message buffer length: {0}", e.Size); Log.WriteLine(LogLevel.Error, "Hexadecimal dump of the message buffer (first 128 bytes):"); Log.WriteLine(LogLevel.Error); Log.WriteLine(LogLevel.Error, HexDump.ToString(e.Buffer, e.Size + TrinityProtocol.TrinityMsgHeader, 128)); Log.WriteLine(LogLevel.Error); Log.Flush(); }