diff options
author | Alan McGovern <alan.mcgovern@gmail.com> | 2016-09-01 01:26:02 +0300 |
---|---|---|
committer | Alan McGovern <alan.mcgovern@gmail.com> | 2016-09-01 01:26:02 +0300 |
commit | 0eaf2cc41fb52b6f5a4a609148f884f185518d98 (patch) | |
tree | 95a32a9030e33f94276580dfd86edd4a968c6ef8 | |
parent | ba96edc32029ada79cdf040f7e7c523311faa24e (diff) |
Add logging and make sure we always shut down
-rw-r--r-- | src/framework/GuiUnit/TestRunner.cs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/framework/GuiUnit/TestRunner.cs b/src/framework/GuiUnit/TestRunner.cs index ff4e987..56da295 100644 --- a/src/framework/GuiUnit/TestRunner.cs +++ b/src/framework/GuiUnit/TestRunner.cs @@ -223,8 +223,13 @@ namespace GuiUnit } else { MainLoop.InitializeToolkit (); System.Threading.ThreadPool.QueueUserWorkItem (d => { - RunTests (filter); - Shutdown (); + try { + RunTests (filter); + } catch (Exception ex) { + Console.WriteLine ("Unexpected error while running the tests: {0}", ex); + } finally { + Shutdown (); + } }); MainLoop.RunMainLoop (); } @@ -261,9 +266,14 @@ namespace GuiUnit // Run the shutdown method on the main thread var helper = new InvokerHelper { Func = () => { - if (BeforeShutdown != null) - BeforeShutdown (null, EventArgs.Empty); - MainLoop.Shutdown (); + try { + if (BeforeShutdown != null) + BeforeShutdown (null, EventArgs.Empty); + } catch (Exception ex) { + Console.WriteLine ("Unexpected error during `BeforeShutdown`: {0}", ex); + } finally { + MainLoop.Shutdown (); + } return null; } }; |