{"record":{"id":"29f529b19f4bc0e6","repo":"PrismLibrary/Prism","slug":"navigationexception-nopageisregistered","errorCode":"NavigationException.NoPageIsRegistered","errorMessage":"NavigationException.NoPageIsRegistered","messagePattern":"NavigationException\\.NoPageIsRegistered","errorType":"exception","errorClass":"NavigationException","httpStatus":null,"severity":"error","filePath":"src/Maui/Prism.Maui/Navigation/Builder/NavigationBuilderExtensions.cs","lineNumber":102,"sourceCode":"        var registrations = registryAware.Registry.ViewsOfType(typeof(NavigationPage));\n        if (!registrations.Any())\n            throw new NavigationException(NavigationException.NoPageIsRegistered, nameof(NavigationPage));\n\n        var registration = registrations.Last();\n        return builder.AddSegment(registration.Name, configureSegment);\n    }\n\n    public static ICreateTabBuilder AddNavigationPage(this ICreateTabBuilder builder) =>\n        builder.AddNavigationPage(b => { });\n\n    public static ICreateTabBuilder AddNavigationPage(this ICreateTabBuilder builder, Action<ISegmentBuilder> configureSegment)\n    {\n        if (builder is not IRegistryAware registryAware)\n            throw new Exception(\"The builder does not implement IRegistryAware\");\n\n        var registrations = registryAware.Registry.ViewsOfType(typeof(NavigationPage));\n        if (!registrations.Any())\n            throw new NavigationException(NavigationException.NoPageIsRegistered, nameof(NavigationPage));\n\n        var registration = registrations.Last();\n        return builder.AddSegment(registration.Name, configureSegment);\n    }\n\n    /// <summary>\n    /// Adds a NavigationPage to the Navigation Uri\n    /// </summary>\n    /// <param name=\"builder\">The <see cref=\"INavigationBuilder\"/>.</param>\n    /// <param name=\"useModalNavigation\">When <see langword=\"true\" /> this will force Modal Navigation.</param>\n    /// <returns>The <see cref=\"INavigationBuilder\"/>.</returns>\n    /// <remarks>This should only be used when you have a single <see cref=\"NavigationPage\"/> registered for Navigation. Typically this is automatically registered for you by Prism.</remarks>\n    public static INavigationBuilder AddNavigationPage(this INavigationBuilder builder, bool useModalNavigation) =>\n        builder.AddNavigationPage(o => o.UseModalNavigation(useModalNavigation));\n\n    /// <summary>\n    /// Navigates back to the specified view model asynchronously.\n    /// </summary>","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Maui/Prism.Maui/Navigation/Builder/NavigationBuilderExtensions.cs#L84-L120","documentation":"AddNavigationPage looks up registrations for typeof(NavigationPage) in the view registry. If none exist it throws NavigationException with code NoPageIsRegistered, because a NavigationPage segment cannot be created for an unregistered page. Prism requires every navigable page to be registered by name in the IViewRegistry.","triggerScenarios":"Calling AddNavigationPage(...) on a tab/segment builder when the app's Prism registration contains no ViewRegistration for NavigationPage (no ViewsOfType<NavigationPage>() match).","commonSituations":"New Prism.Maui 9 apps that forgot `navigatorRegistry.Register<NavigationPage>()` / `RegisterViewType(nameof(NavigationPage), typeof(NavigationPage))`; migrating from Prism.Forms where NavigationPage was implicit; template projects where NavigationPage registration was removed.","solutions":["Register NavigationPage in the view registry: `registry.RegisterForNavigation<NavigationPage>(nameof(NavigationPage));` or `services.AddSingleton(new ViewRegistration { Name = nameof(NavigationPage), View = typeof(NavigationPage) });`","Verify the registration happens before navigation at startup (CreateWindow / App setup).","If you don't want a NavigationPage, remove the AddNavigationPage call and use AddSegment with your root page directly."],"exampleFix":"// before\nbuilder.AddSegment(\"MainPage\").AddNavigationPage(); // throws if NavigationPage unregistered\n// after (in app registration)\nregistry.RegisterForNavigation<NavigationPage>(nameof(NavigationPage));\nbuilder.AddSegment(\"MainPage\").AddNavigationPage();","handlingStrategy":"validation","validationCode":"var regs = ((IRegistryAware)builder).Registry.ViewsOfType(typeof(NavigationPage));\nif (!regs.Any()) throw new InvalidOperationException(\"Register NavigationPage before AddNavigationPage\");","typeGuard":"null","tryCatchPattern":"try { builder.AddNavigationPage(); }\ncatch (NavigationException ex) when (ex.Code == NavigationException.NoPageIsRegistered)\n{\n    // register NavigationPage or continue without a navigation page segment\n}","preventionTips":["Always register NavigationPage in the Prism registry at startup","Centralize registrations in one module so nothing is skipped","Use nameof(NavigationPage) as the registration name"],"tags":["prism","maui","navigation","registration","navigationpage"],"backgroundTag":"entity-not-found","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"}