PrismLibrary/Prism · critical · InvalidNavigationException
Expected Navigation Failed. No Root Window has been created.
Error message
Expected Navigation Failed. No Root Window has been created.
What it means
PrismWindowManager.CreateWindow is responsible for producing the app's initial PrismWindow. It first checks the app's Windows collection, then triggers PrismAppBuilder.OnCreateWindow() and, if still no window was created, throws InvalidNavigationException 'Expected Navigation Failed. No Root Window has been created.' This means the Prism window-creation pipeline never registered a root window, so no navigation can be started.
Solutions
- Remove any custom CreateWindow override in App (or the default template one) so Prism's window manager handles window creation.
- Ensure PrismAppBuilder is configured with UsePrismAppBuilder and that OnAppStart sets a valid initial navigation URI whose view is registered.
- If a custom IWindowCreator is used, verify it actually creates/returns a PrismWindow.
- Check that the initial route/view named in OnAppStart is registered via RegisterForNavigation; a failed initial nav can leave _initialWindow null.
Example fix
// before (App.xaml.cs)
protected override Window CreateWindow(IActivationState activationState) =>
new Window(); // bypasses Prism
// after
// delete the override and configure Prism:
builder.UsePrismAppBuilder(prism => prism.OnAppStart(navigation =>
navigation.CreateBuilder().NavigateAsync("MainPage"))); Defensive patterns
Strategy: validation
Validate before calling
// verify prism window creation at startup
var window = App.Current.Windows.OfType<PrismWindow>().FirstOrDefault();
if (window is null)
throw new InvalidOperationException("Prism window not created; check OnAppStart and App.CreateWindow override."); Prevention
- Never override App.CreateWindow in a Prism MAUI app.
- Confirm OnAppStart registers a valid, registered initial view.
- Call builder.UsePrismAppBuilder in MauiProgram.
- Test cold start on each platform after upgrades.
When it happens
Trigger: MAUI's built-in Window creation bypasses Prism - e.g. not removing the default 'CreateWindow' handling or not letting Prism's CreateWindow handler run; a custom IWindowCreator/App.Start returning null; App.xaml.cs overrides CreateWindow and does not call the Prism path; PrismAppBuilder.OnCreateWindow produced no window due to missing view registration for the initial navigation.
Common situations: Upgrading a MAUI app where the default App.CreateWindow override from the template still exists and intercepts window creation; forgetting to call builder.UsePrismAppBuilder or removing OnAppStart navigation; custom splash/window logic creating a non-PrismWindow.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- The current window ' ' is not a PrismWindow.
- No Window has been set in the Application
- Prism applications only support the use of PrismWindow, but…
- No current page has been set.
- An error was encountered while configuring the Module…
AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15).
Data as JSON: /api/errors/22161d5e78cb3951.
Report an issue: GitHub.
Appendix: source
Thrown at src/Maui/Prism.Maui/Navigation/PrismWindowManager.cs:31
}
private Window _initialWindow;
private Window _current;
public Window Current => _current ?? _initialWindow;
public IReadOnlyList<Window> Windows => _application.Windows.OfType<Window>().ToList();
public Window CreateWindow(Application app, IActivationState activationState)
{
if (_initialWindow is not null)
return _initialWindow;
else if (app.Windows.OfType<PrismWindow>().Any())
return _initialWindow = app.Windows.OfType<PrismWindow>().First();
activationState.Context.Services.GetRequiredService<PrismAppBuilder>().OnCreateWindow();
return _initialWindow ?? throw new InvalidNavigationException("Expected Navigation Failed. No Root Window has been created.");
}
public void OpenWindow(Window window)
{
if (_initialWindow is null)
_initialWindow = window;
else
_application.OpenWindow(window);
foreach(var pWindow in Windows.OfType<PrismWindow>().Where(x => x.IsActive))
{
pWindow.IsActive = window.Equals(pWindow);
}
}
public void CloseWindow(Window window)
{
if (_initialWindow == window)View on GitHub (pinned to 358118cd64)