Windows平台MAUI Shell导航随机崩溃问题求助
MAUI AppShell 导航随机崩溃问题
- 测试场景:搭建简易MAUI项目,MainPage绑定MainPageViewModel,通过按钮或手势触发相对路由导航至SelectPage(保留导航栏返回按钮)
- 异常表现:反复在两页面间切换时,随机触发未处理的
Microsoft.UI.Xaml.Controls.Frame.NavigationFailed异常,崩溃时机无规律;但用ScreenToGif录制操作时,第二次导航必然崩溃。崩溃前会先抛出System.Runtime.InteropServices.COMException异常 - 简化验证:已将项目精简到仅保留MainPage的按钮和SelectPage的标签,问题依然复现;关键发现:若SelectPage的根ContentPage内没有任何元素,不会出现崩溃,但只要添加一个简单Label,崩溃就会复现
异常堆栈跟踪:
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|38_0(Int32 hr) at ABI.Microsoft.UI.Xaml.Controls.IFrameMethods.Navigate(IObjectReference _obj, Type sourcePageType, Object parameter, NavigationTransitionInfo infoOverride) at Microsoft.Maui.Platform.StackNavigationManager.NavigateTo(NavigationRequest args) at Microsoft.Maui.CommandMapper.InvokeCore(String key, IElementHandler viewHandler, IElement virtualView, Object args) at Microsoft.Maui.Controls.Handlers.ShellSectionHandler.SyncNavigationStack(Boolean animated, NavigationRequestedEventArgs e) at Microsoft.Maui.Controls.Handlers.ShellSectionHandler.OnNavigationRequested(Object sender, NavigationRequestedEventArgs e) at Microsoft.Maui.Controls.ShellSection.InvokeNavigationRequest(NavigationRequestedEventArgs args) at Microsoft.Maui.Controls.ShellSection.OnPushAsync(Page page, Boolean animated) at Microsoft.Maui.Controls.ShellSection.PushStackOfPages(List`1 pages, Nullable`1 animate) at Microsoft.Maui.Controls.ShellSection.GoToAsync(ShellNavigationRequest request, ShellRouteParameters queryData, IServiceProvider services, Nullable`1 animate, Boolean isRelativePopping) at Microsoft.Maui.Controls.ShellNavigationManager.GoToAsync(ShellNavigationParameters shellNavigationParameters, ShellNavigationRequest navigationRequest) at TestinMAUIPageNavigationPerf.Sources.ViewModels.ItemViewModel.SelectItem()
内容的提问来源于stack exchange,提问作者TRex
相关产品推荐
相关产品推荐

