diff --git a/test/Eto.Test/UnitTests/TestBase.cs b/test/Eto.Test/UnitTests/TestBase.cs index 9646dd4e5..51b5c2044 100755 --- a/test/Eto.Test/UnitTests/TestBase.cs +++ b/test/Eto.Test/UnitTests/TestBase.cs @@ -61,6 +61,7 @@ public override TestResult Execute(TestExecutionContext context) public class EtoTestSetup { static bool _quit; + static bool _appWasCreated; /// /// Timeout for application initialization @@ -157,6 +158,8 @@ public static void Initialize() thread.Start(); if (!ev.WaitOne(ApplicationTimeout)) Assert.Fail("Could not initialize application"); + + _appWasCreated = true; if (exception != null) ExceptionDispatchInfo.Capture(exception).Throw(); } @@ -173,6 +176,8 @@ public void GlobalSetup() public void GlobalTeardown() { _quit = true; + if (!_appWasCreated) + return; Application.Instance?.AsyncInvoke(() => { Application.Instance?.Quit();