comparison 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
comparison
equal deleted inserted replaced
38:8ab98a803d39 39:7645122aa7a9
55 55
56 /// <summary>Shows exception details in a message box.</summary> 56 /// <summary>Shows exception details in a message box.</summary>
57 /// <param name="e">The exception to show.</param> 57 /// <param name="e">The exception to show.</param>
58 static void ShowError(Exception e) 58 static void ShowError(Exception e)
59 { 59 {
60 string simpleStackTrace = string.Join(Environment.NewLine, new System.Diagnostics.StackTrace(e).GetFrames() 60 string simpleStackTrace = Helpers.IsMono()
61 .Select(f => f.GetMethod().DeclaringType.Name + "." + f.GetMethod().Name).ToArray()); 61 ? e.ToString()
62 : string.Join(Environment.NewLine, new System.Diagnostics.StackTrace(e).GetFrames()
63 .Select(f => f.GetMethod().DeclaringType.Name + "." + f.GetMethod().Name).ToArray());
62 MessageBox.Show(e.Message + Environment.NewLine + Environment.NewLine + simpleStackTrace, "Server Monitor Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 64 MessageBox.Show(e.Message + Environment.NewLine + Environment.NewLine + simpleStackTrace, "Server Monitor Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
63 } 65 }
64 } 66 }
65 } 67 }