PrismLibrary / Prism

Prism is a framework for building loosely coupled, maintainable, and testable XAML applications in WPF, Xamarin Forms, and Uno / Win UI Applications..

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Expected Navigation Failed. No Root Window has been created.

roubachof opened this issue · comments

Description

I have a big maui application for a big android device (not a mobile).
There are tons of initialization and async calls in OnInitialized and then:

navigationService.NavigateAsync(
    $"/{nameof(MainMasterDetailView)}/{nameof(CommonNavigationPage)}/{nameof(MainView)}?{MainView.ShowDashboardNavigationParameter}=False");

is called in OnAppStart.
For obvious reasons I can't make a repo sample of this, but I was wondering if you had some pointers to see what is not working.
For what I understand, it seems that Activity.OnCreate is called before the navigation is made, and since the prism root window is created when we first navigate, the exception occurs...

Steps to Reproduce

Unfortunately no repo sample.

Platform with bug

.NET MAUI

Affected platforms

Android, I was not able test on other platforms

Did you find any workaround?

No response

Relevant log output

10:25:49:202	[0:] Navigation: http://localhost/MainMasterDetailView/CommonNavigationPage/MainView?ShowDashboard=False
10:25:49:202	[0:] Result: Failed
10:25:49:202	[0:] NavigationRequestContext { Cancelled = False, Type = Navigate, Uri = http://localhost/MainMasterDetailView/CommonNavigationPage/MainView?ShowDashboard=False, Parameters = , Result = Prism.Navigation.NavigationResult }
10:25:49:514	**Microsoft.Maui.Controls.InvalidNavigationException:** 'Expected Navigation Failed. No Root Window has been created.'

HOLD ON: I am maybe an idiot: navigation failed x) so window has NOT been built.
Will re-open if I'm not an idiot :)