From c8dac270ba08e104df9362bd8e8cb428d19621a0 Mon Sep 17 00:00:00 2001 From: Jakub Florkowski Date: Sun, 26 May 2024 20:01:38 +0200 Subject: [PATCH] Fix #22570 & UI Test --- .../src/Core/Shell/ShellNavigationManager.cs | 6 +++- .../TestCases.HostApp/Issues/Issue22570.xaml | 22 ++++++++++++ .../Issues/Issue22570.xaml.cs | 36 +++++++++++++++++++ .../Tests/Issues/Issue22570.cs | 24 +++++++++++++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue22570.xaml create mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue22570.xaml.cs create mode 100644 src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22570.cs diff --git a/src/Controls/src/Core/Shell/ShellNavigationManager.cs b/src/Controls/src/Core/Shell/ShellNavigationManager.cs index 9329bf1a5f11..04028e07603d 100644 --- a/src/Controls/src/Core/Shell/ShellNavigationManager.cs +++ b/src/Controls/src/Core/Shell/ShellNavigationManager.cs @@ -115,7 +115,11 @@ internal async Task GoToAsync( modalStackPreBuilt = true; bool? isAnimated = (nextActiveSection != currentShellSection) ? false : animate; - await nextActiveSection.GoToAsync(navigationRequest, parameters, _shell.FindMauiContext()?.Services, isAnimated, isRelativePopping); + + await _shell.Dispatcher.DispatchAsync(() => + { + _ = nextActiveSection.GoToAsync(navigationRequest, parameters, _shell.FindMauiContext()?.Services, isAnimated, isRelativePopping); + }); } if (shellItem != null) diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue22570.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue22570.xaml new file mode 100644 index 000000000000..64ae5817720a --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue22570.xaml @@ -0,0 +1,22 @@ + + + + + + +