PrismLibrary/Prism · error · NavigationException

NavigationException.UnsupportedMauiNavigation

NavigationException.UnsupportedMauiNavigation

Error message

NavigationException.UnsupportedMauiNavigation

What it means

PageNavigationService wraps the whole MAUI platform navigation operation in a try/catch and rethrows any non-Prism exception as a NavigationException with code UnsupportedMauiNavigation. It signals that an underlying MAUI navigation call (PushAsync, PopAsync, RemovePage, etc.) failed with a platform-level exception, preserving the original as InnerException.

Solutions

  1. Read the InnerException to identify the real MAUI failure; fix the underlying cause.
  2. Serialize navigation calls (await each NavigateAsync/GoBackAsync; debounce buttons) to avoid concurrent navigations.
  3. Check Navigation.NavigationStack contents before requesting pops or removals.
  4. Ensure navigation happens after window activation (e.g. from OnNavigatedTo/lifecycle events, not before the window exists).

Example fix

// before
NavigationService.NavigateAsync("Detail");
NavigationService.NavigateAsync("Other"); // concurrent -> platform exception

// after
private Task _nav;
_nav = _nav ?? _navigationService.NavigateAsync("Detail"); // serialize
await _nav;
Defensive patterns

Strategy: try-catch

Validate before calling

if (navigationInProgress) return;

Try / catch

try
{
    await _navigationService.GoBackAsync();
}
catch (NavigationException ex) when (ex.Code == NavigationException.UnsupportedMauiNavigation)
{
    // inspect ex.InnerException; log; debounce further navigations
}

Prevention

When it happens

Trigger: Any internal MAUI NavigationStack manipulation during GoBackAsync/GoBackToRootAsync/ProcessNavigation that throws - e.g. pushing a page while another navigation is in flight, popping an empty stack, or platform handler errors - inside the try block ending at line 1271.

Common situations: Rapid double-taps triggering concurrent navigations; popping pages from a stack that was cleared on Window creation; device/platform-specific handler failures (Android/iOS) during animated transitions; navigating before the main window/page is fully attached.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15). Data as JSON: /api/errors/c31f6bc675409fbf. Report an issue: GitHub.

Appendix: source

Thrown at src/Maui/Prism.Maui/Navigation/PageNavigationService.cs:1271

                {
                    await currentPage.Navigation.PushModalAsync(page, animated ?? true);
                }
                else
                {
                    if (insertBeforeLast)
                    {
                        await InsertPageBefore(currentPage, page, navigationOffset);
                    }
                    else
                    {
                        await currentPage.Navigation.PushAsync(page, animated ?? true);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw new NavigationException(NavigationException.UnsupportedMauiNavigation, _pageAccessor.Page, ex);
        }
    }

    protected virtual Task InsertPageBefore(Page currentPage, Page page, int pageOffset)
    {
        var firstPage = currentPage.Navigation.NavigationStack.Skip(pageOffset).FirstOrDefault();
        currentPage.Navigation.InsertPageBefore(page, firstPage);
        return Task.FromResult(true);
    }

    protected virtual Task<Page> DoPop(INavigation navigation, bool useModalNavigation, bool animated)
    {
        if (useModalNavigation)
            return navigation.PopModalAsync(animated);
        else
            return navigation.PopAsync(animated);
    }

View on GitHub (pinned to 358118cd64)