dotnet/maui · error · InvalidOperationException
PopAsync is not supported globally on Windows, please use a
Error message
PopAsync is not supported globally on Windows, please use a NavigationPage.
What it means
The Windows Platform class's explicit INavigation.PopAsync(bool) throws unconditionally. PopAsync (removing the current page from the stack) is only supported when a NavigationPage manages the stack, not through the global Platform navigation context.
Source
Thrown at src/Compatibility/Core/src/Windows/Platform.cs:217
Task<Page> INavigation.PopAsync()
{
return ((INavigation)this).PopAsync(true);
}
Task INavigation.PopToRootAsync()
{
return ((INavigation)this).PopToRootAsync(true);
}
Task INavigation.PushAsync(Page root, bool animated)
{
throw new InvalidOperationException("PushAsync is not supported globally on Windows, please use a NavigationPage.");
}
Task<Page> INavigation.PopAsync(bool animated)
{
throw new InvalidOperationException("PopAsync is not supported globally on Windows, please use a NavigationPage.");
}
Task INavigation.PopToRootAsync(bool animated)
{
throw new InvalidOperationException(
"PopToRootAsync is not supported globally on Windows, please use a NavigationPage.");
}
void INavigation.RemovePage(Page page)
{
throw new InvalidOperationException("RemovePage is not supported globally on Windows, please use a NavigationPage.");
}
void INavigation.InsertPageBefore(Page page, Page before)
{
throw new InvalidOperationException(
"InsertPageBefore is not supported globally on Windows, please use a NavigationPage.");
}View on GitHub (pinned to f377ff1c5e)
Solutions
- Wrap the root page in a NavigationPage so PopAsync delegates to NavigationPage's navigation stack
- Use modal navigation (PopModalAsync) which is supported globally
- Conditionally branch navigation logic for Windows platform
Example fix
// before MainPage = new MyContentPage(); await MainPage.Navigation.PopAsync(); // throws // after MainPage = new NavigationPage(new MyContentPage()); await MainPage.Navigation.PopAsync(); // works
Defensive patterns
Strategy: validation
Validate before calling
// Before calling PopAsync, verify NavigationPage hosts the stack
if (Application.Current.MainPage is NavigationPage navPage && navPage.Navigation.NavigationStack.Count > 1)
{
await navPage.Navigation.PopAsync();
}
else
{
// Cannot pop — either no NavigationPage or already at root
Application.Current.MainPage = rootPage; // reset directly
} Type guard
static bool CanPop()
{
return Application.Current.MainPage is NavigationPage nav
&& nav.Navigation.NavigationStack.Count > 1;
} Prevention
- Use NavigationPage as the root container on all platforms
- Check Navigation.NavigationStack.Count before calling PopAsync
- Abstract navigation behind a service to centralize platform checks
When it happens
Trigger: Calling Application.Current.MainPage.Navigation.PopAsync() when MainPage is not wrapped in a NavigationPage. The global Platform INavigation implementation rejects all stack-based pop operations.
Common situations: Shared navigation code that calls PopAsync without checking the page hierarchy; app structured with a single root page rather than NavigationPage on Windows.
Related errors
- PushAsync is not supported globally on Windows, please use a
- PopToRootAsync is not supported globally on Windows, please
- RemovePage is not supported globally on Windows, please use
- InsertPageBefore is not supported globally on Windows, pleas
- Could not find or create a renderer for {visualElement}
AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13).
Data as JSON: /api/errors/018df2c85bff0e0f.
Report an issue: GitHub.