{"record":{"id":"da5fc89593e7c606","repo":"PrismLibrary/Prism","slug":"the-page-type-target-gettype-fullname-is-not-supported","errorCode":null,"errorMessage":"The page type '{target.GetType().FullName}' is not supported.","messagePattern":"The page type '(.+?)' is not supported\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Maui/Prism.Maui/Common/MvvmHelpers.cs","lineNumber":307,"sourceCode":"        var page = mainPage;\n\n        var lastModal = page.Navigation.ModalStack.LastOrDefault();\n        if (lastModal != null)\n            page = lastModal;\n\n        return EvaluateCurrentPage(page);\n    };\n\n    internal static Page? GetTarget(Page? target)\n    {\n        return target switch\n        {\n            FlyoutPage flyout => GetTarget(flyout.Detail),\n            TabbedPage tabbed => GetTarget(tabbed.CurrentPage),\n            NavigationPage navigation => GetTarget(navigation.CurrentPage) ?? navigation,\n            ContentPage page => page,\n            null => null,\n            _ => throw new NotSupportedException($\"The page type '{target.GetType().FullName}' is not supported.\")\n        };\n    }\n\n    private static Page? EvaluateCurrentPage(Page? target)\n    {\n        Page? child = GetTarget(target);\n\n        if (child is not null)\n            target = GetOnNavigatedToTargetFromChild(child);\n\n        if (target is { } page)\n        {\n            if (target is IDialogContainer)\n            {\n                return page.Parent switch\n                {\n                    Page parentPage => GetTarget(parentPage),\n                    Window window => GetTarget(window.Page),","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Maui/Prism.Maui/Common/MvvmHelpers.cs#L289-L325","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Make your pages derive from ContentPage (or use the exact FlyoutPage/TabbedPage/NavigationPage types as containers).","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.","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).","As a last resort, catch NotSupportedException around current-page access and handle the unknown page type."],"exampleFix":"// before\npublic class MyFancyPage : Page { ... }\n\n// after\npublic class MyFancyPage : ContentPage { ... }","handlingStrategy":"type-guard","validationCode":"if (page is ContentPage or NavigationPage or TabbedPage or FlyoutPage)\n    NavigateOrQuery(page);\nelse\n    logger.Warn($\"Page {page.GetType().Name} unsupported by Prism current-page resolution\");","typeGuard":"bool IsPrismSupportedPage(Page? p) =>\n    p is null or ContentPage or FlyoutPage or TabbedPage or NavigationPage;","tryCatchPattern":"try { var target = MvvmHelpers.GetCurrentPage(root); }\ncatch (NotSupportedException ex) { logger.Error(ex, \"Unsupported page type\"); }","preventionTips":["Derive all app pages from ContentPage.","Avoid subclassing NavigationPage/TabbedPage/FlyoutPage — use them directly.","Add a unit test that walks your app's navigation stack through GetTarget-style unwrapping."],"tags":["prism","maui","navigation","unsupported-page-type"],"backgroundTag":"unsupported-operation","analyzedSha":"358118cd640d9a22ff8cf21c8ad197fa038b7990","analyzedAt":"2026-09-15T15:00:31.079Z","contentChangedAt":"2026-09-15T15:00:31.079Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}