From 76f87269510847ec90c13e617f52a772fca7f32e Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 7 Jun 2018 11:17:55 +1000 Subject: [PATCH] also include native hresult for unhandleded crashes with native code exceptions --- ClassicalSharp/Utils/ErrorHandler.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ClassicalSharp/Utils/ErrorHandler.cs b/ClassicalSharp/Utils/ErrorHandler.cs index c2891a478..0c96ba362 100644 --- a/ClassicalSharp/Utils/ErrorHandler.cs +++ b/ClassicalSharp/Utils/ErrorHandler.cs @@ -2,6 +2,7 @@ using System; using System.Diagnostics; using System.IO; +using System.Runtime.InteropServices; using System.Windows.Forms; using OpenTK; @@ -27,7 +28,11 @@ namespace ClassicalSharp { static string Format(Exception ex) { try { - return ex.GetType().FullName + ": " + ex.Message + Environment.NewLine + ex.StackTrace; + string msg = ex.GetType().FullName + ": " + ex.Message + Environment.NewLine + ex.StackTrace; + ExternalException nativeEx = ex as ExternalException; + + if (nativeEx == null) return msg; + return msg + Environment.NewLine + "HRESULT: " + nativeEx.ErrorCode; } catch (Exception) { return ""; }