From 11524630d3bdce7f028e8821e4fb4aaac52938bc Mon Sep 17 00:00:00 2001 From: BDisp Date: Fri, 2 Apr 2021 19:54:22 +0100 Subject: [PATCH] Fixes #1167. Application.Run method with #DEBUG can be simplified. (#1168) --- Terminal.Gui/Core/Application.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Terminal.Gui/Core/Application.cs b/Terminal.Gui/Core/Application.cs index 0d37fda83..c94734e38 100644 --- a/Terminal.Gui/Core/Application.cs +++ b/Terminal.Gui/Core/Application.cs @@ -700,19 +700,15 @@ namespace Terminal.Gui { public static void Run (Toplevel view, Func errorHandler = null) { var resume = true; - while (resume) - { -#if DEBUG + while (resume) { +#if !DEBUG + try { +#endif resume = false; var runToken = Begin (view); RunLoop (runToken); End (runToken); -#else - try { - resume = false; - var runToken = Begin (view); - RunLoop (runToken); - End (runToken); +#if !DEBUG } catch (Exception error) {