[mapguide-commits] r5984 - trunk/Tools/Maestro/Maestro

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jul 8 08:23:45 EDT 2011


Author: jng
Date: 2011-07-08 05:23:45 -0700 (Fri, 08 Jul 2011)
New Revision: 5984

Modified:
   trunk/Tools/Maestro/Maestro/Program.cs
Log:
Add a top-level handler for unhandled AppDomain exceptions


Modified: trunk/Tools/Maestro/Maestro/Program.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/Program.cs	2011-07-08 01:57:22 UTC (rev 5983)
+++ trunk/Tools/Maestro/Maestro/Program.cs	2011-07-08 12:23:45 UTC (rev 5984)
@@ -70,6 +70,7 @@
             ResourceValidatorLoader.LoadStockValidators();
 
             AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(CurrentDomain_AssemblyLoad);
+            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
 
             // Get a reference to the entry assembly (Startup.exe)
             Assembly exe = typeof(Program).Assembly;
@@ -141,6 +142,15 @@
             LoggingService.Info("Application shutdown");
         }
 
+        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+        {
+            var ex = e.ExceptionObject as Exception;
+            if (ex != null)
+            {
+                ErrorDialog.Show(ex);
+            }
+        }
+
         static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
         {
             LoggingService.InfoFormatted("Loaded assembly: {0}", args.LoadedAssembly.GetName().Name);



More information about the mapguide-commits mailing list