PrismLibrary/Prism · error · NotSupportedException

The page type ' ' is not supported.

Error message

The page type '{target.GetType().FullName}' is not supported.

What it means

MvvmHelpers.GetTarget resolves the 'current page' by unwrapping shell-like containers (FlyoutPage, TabbedPage, NavigationPage) down to a concrete ContentPage. If the page is none of the supported types (and not null), Prism throws NotSupportedException because it cannot determine which page to treat as current. This is a deliberate limitation: only a fixed set of page types is unwrapped.

Solutions

  1. Make your pages derive from ContentPage (or use the exact FlyoutPage/TabbedPage/NavigationPage types as containers).
  2. If you subclass TabbedPage/NavigationPage/FlyoutPage, unwrap to a supported type before Prism queries the current page, or override the current-page logic in your app.
  3. Ensure the page at issue is reachable through the supported wrappers (e.g. wrap your custom page's inner ContentPage as flyout.Detail / tab.CurrentPage).
  4. As a last resort, catch NotSupportedException around current-page access and handle the unknown page type.

Example fix

// before
public class MyFancyPage : Page { ... }

// after
public class MyFancyPage : ContentPage { ... }
Defensive patterns

Strategy: type-guard

Validate before calling

if (page is ContentPage or NavigationPage or TabbedPage or FlyoutPage)
    NavigateOrQuery(page);
else
    logger.Warn($"Page {page.GetType().Name} unsupported by Prism current-page resolution");

Type guard

bool IsPrismSupportedPage(Page? p) =>
    p is null or ContentPage or FlyoutPage or TabbedPage or NavigationPage;

Try / catch

try { var target = MvvmHelpers.GetCurrentPage(root); }
catch (NotSupportedException ex) { logger.Error(ex, "Unsupported page type"); }

Prevention

When it happens

Trigger: GetTarget is called (directly or via EvaluateCurrentPage/_getCurrentPage) with a Page that is not a FlyoutPage, TabbedPage, NavigationPage, or ContentPage — e.g. a custom page subclass, a CarouselPage, or a third-party page type. Note FlyoutPage/TabbedPage/NavigationPage matching is exact, so subclasses of these containers also fall through to the throw.

Common situations: Using a custom base page class that derives from Page directly instead of ContentPage; subclassing NavigationPage or TabbedPage (the pattern-matching `is` requires the exact types in this switch); using unsupported MAUI pages like CarouselView-based custom pages as the app root; shell/Window scenarios with custom page containers.

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/da5fc89593e7c606. Report an issue: GitHub.

Appendix: source

Thrown at src/Maui/Prism.Maui/Common/MvvmHelpers.cs:307

        var page = mainPage;

        var lastModal = page.Navigation.ModalStack.LastOrDefault();
        if (lastModal != null)
            page = lastModal;

        return EvaluateCurrentPage(page);
    };

    internal static Page? GetTarget(Page? target)
    {
        return target switch
        {
            FlyoutPage flyout => GetTarget(flyout.Detail),
            TabbedPage tabbed => GetTarget(tabbed.CurrentPage),
            NavigationPage navigation => GetTarget(navigation.CurrentPage) ?? navigation,
            ContentPage page => page,
            null => null,
            _ => throw new NotSupportedException($"The page type '{target.GetType().FullName}' is not supported.")
        };
    }

    private static Page? EvaluateCurrentPage(Page? target)
    {
        Page? child = GetTarget(target);

        if (child is not null)
            target = GetOnNavigatedToTargetFromChild(child);

        if (target is { } page)
        {
            if (target is IDialogContainer)
            {
                return page.Parent switch
                {
                    Page parentPage => GetTarget(parentPage),
                    Window window => GetTarget(window.Page),

View on GitHub (pinned to 358118cd64)