From 1aa44984b72a2104e51cf69aa58622b6de6d814e Mon Sep 17 00:00:00 2001 From: ShadowMarker789 <37165910+ShadowMarker789@users.noreply.github.com> Date: Sat, 1 Oct 2022 13:17:14 +0800 Subject: [PATCH] Fix for Issue 9064 - Dispatcher call instead https://github.com/AvaloniaUI/Avalonia/issues/9064 Fix for throwing unhandled exception in screen page, replace direct invalidate visual with dispatcher invocation of invalidate visual --- samples/ControlCatalog/Pages/ScreenPage.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/ControlCatalog/Pages/ScreenPage.cs b/samples/ControlCatalog/Pages/ScreenPage.cs index dde622d585..e0627eca1c 100644 --- a/samples/ControlCatalog/Pages/ScreenPage.cs +++ b/samples/ControlCatalog/Pages/ScreenPage.cs @@ -6,6 +6,7 @@ using Avalonia.Markup.Xaml; using Avalonia.Media; using Avalonia.Platform; using Avalonia.Rendering; +using Avalonia.Threading; namespace ControlCatalog.Pages { @@ -40,7 +41,7 @@ namespace ControlCatalog.Pages if (screen.Bounds.X / 10f < _leftMost) { _leftMost = screen.Bounds.X / 10f; - InvalidateVisual(); + Dispatcher.UIThread.Post(InvalidateVisual, DispatcherPriority.Background); return; }