diff --git a/Tests/TerminalGuiFluentTesting/GuiTestContext.cs b/Tests/TerminalGuiFluentTesting/GuiTestContext.cs index 6321a86cb..c98c34b24 100644 --- a/Tests/TerminalGuiFluentTesting/GuiTestContext.cs +++ b/Tests/TerminalGuiFluentTesting/GuiTestContext.cs @@ -137,6 +137,12 @@ public class GuiTestContext : IDisposable throw _ex; // Propagate any exception that happened in the background task } + if (Application.Top is { Running: false }) + { + Application.Top?.Dispose (); + Application.Shutdown (); + } + return this; }