@@ -275,6 +275,8 @@ public class ApplicationImpl : IApplication
if (Application.MainThreadId == Thread.CurrentThread.ManagedThreadId)
{
action ();
+ WakeupMainLoop ();
+
return;
}
@@ -293,6 +295,15 @@ public class ApplicationImpl : IApplication
return false;
);
+ void WakeupMainLoop ()
+ {
+ // Ensure the action is executed in the main loop
+ // Wakeup mainloop if it's waiting for events
+ Application.MainLoop?.Wakeup ();
+ }
/// <inheritdoc />
@@ -807,7 +807,7 @@ public partial class View // Drawing APIs
// There was multiple enumeration error here, so calling ToArray - probably a stop gap
- foreach (View subview in SubViews.ToArray ())
+ foreach (View subview in InternalSubViews)
if (subview.Frame.IntersectsWith (viewPortRelativeRegion))
@@ -11,6 +11,8 @@ public class SpinnerViewTests (ITestOutputHelper output)
[InlineData (false)]
public void TestSpinnerView_AutoSpin (bool callStop)
+ ConsoleDriver.RunningUnitTests = true;
SpinnerView view = GetSpinnerView ();
Assert.Empty (Application.MainLoop.TimedEvents.Timeouts);