diff ServerMonitor/Program.cs @ 39:7645122aa7a9

Get it working under Mono
author Brad Greco <brad@bgreco.net>
date Tue, 09 Jun 2020 20:59:00 -0400
parents 68d7834dc28e
children
line wrap: on
line diff
--- a/ServerMonitor/Program.cs	Sun Sep 15 21:01:14 2019 -0400
+++ b/ServerMonitor/Program.cs	Tue Jun 09 20:59:00 2020 -0400
@@ -57,8 +57,10 @@
         /// <param name="e">The exception to show.</param>
         static void ShowError(Exception e)
         {
-            string simpleStackTrace = string.Join(Environment.NewLine, new System.Diagnostics.StackTrace(e).GetFrames()
-                    .Select(f => f.GetMethod().DeclaringType.Name + "." + f.GetMethod().Name).ToArray());
+            string simpleStackTrace = Helpers.IsMono()
+                ? e.ToString()
+                : string.Join(Environment.NewLine, new System.Diagnostics.StackTrace(e).GetFrames()
+                        .Select(f => f.GetMethod().DeclaringType.Name + "." + f.GetMethod().Name).ToArray());
             MessageBox.Show(e.Message + Environment.NewLine + Environment.NewLine + simpleStackTrace, "Server Monitor Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }