{"record":{"id":"702776342f5da38c","repo":"PrismLibrary/Prism","slug":"no-view-with-the-name-name-has-been-registered","errorCode":null,"errorMessage":"No view with the name '{name}' has been registered","messagePattern":"No view with the name '(.+?)' has been registered","errorType":"exception","errorClass":"KeyNotFoundException","httpStatus":null,"severity":"error","filePath":"src/Prism.Core/Mvvm/ViewRegistryBase{TBaseView}.cs","lineNumber":54,"sourceCode":"    /// <param name=\"name\">The name of the view to retrieve.</param>\n    /// <returns>The type of the view, or null if not found.</returns>\n    public Type? GetViewType(string name) =>\n        GetRegistration(name)?.View;\n\n    /// <summary>\n    /// Creates an instance of the specified view using the provided container.\n    /// </summary>\n    /// <param name=\"container\">The container used to resolve dependencies.</param>\n    /// <param name=\"name\">The name of the view to create.</param>\n    /// <returns>An instance of the created view.</returns>\n    /// <exception cref=\"KeyNotFoundException\">Thrown if the specified view is not registered.</exception>\n    /// <exception cref=\"ViewModelCreationException\">Thrown if an error occurs while creating the view model.</exception>\n    /// <exception cref=\"ViewCreationException\">Thrown if an error occurs while creating the view.</exception>\n    public object? CreateView(IContainerProvider container, string name)\n    {\n        try\n        {\n            var registration = GetRegistration(name) ?? throw new KeyNotFoundException($\"No view with the name '{name}' has been registered\");\n            var view = container.Resolve(registration.View) as TBaseView;\n            SetNavigationNameProperty(view, registration.Name);\n\n            SetContainerProvider(view, container);\n            ConfigureView(view, container);\n\n            if (registration.ViewModel is not null)\n                SetViewModelProperty(view, registration.ViewModel);\n\n            Autowire(view);\n\n            return view;\n        }\n        catch (KeyNotFoundException)\n        {\n            throw;\n        }\n        catch (ViewModelCreationException)","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Prism.Core/Mvvm/ViewRegistryBase{TBaseView}.cs#L36-L72","documentation":"ViewRegistryBase.CreateView looks up a view registration by name via GetRegistration(name); when no view with that name has been registered in the view registry it throws KeyNotFoundException. Prism's view registry must know every view that will be resolved by name for navigation or ViewModelLocator resolution.","triggerScenarios":"Calling CreateView(container, name) (directly or via navigation/ViewModelLocator) with a name that was never registered through RegisterView, or with a name whose registration was removed/renamed.","commonSituations":"Typo in the view name used during navigation (e.g. 'DetailsView' vs 'DetailView'); view registered in a different registry or after navigation runs; DI container lacks the view type registration; platform-specific registration assembly not loaded.","solutions":["Register the view with the exact name: use ViewRegistry registration (e.g. in App startup) matching the string passed to CreateView.","Verify the name string for typos and casing against the registration call.","Ensure the view type is also resolvable from the DI container.","Check registration order — the view must be registered before navigation/creation occurs."],"exampleFix":"// before (view never registered)\nnavigationService.NavigateAsync(\"DetailsView\");\n// after\ncontainerRegistry.RegisterForNavigation<DetailsView>(\"DetailsView\");\nnavigationService.NavigateAsync(\"DetailsView\");","handlingStrategy":"try-catch","validationCode":"if (!viewRegistry.IsRegistered(name))\n    throw new InvalidOperationException($\"View '{name}' must be registered before navigation\");","typeGuard":null,"tryCatchPattern":"try { var view = registry.CreateView(container, name); }\ncatch (KeyNotFoundException ex) { logger.LogError(ex, \"View '{Name}' not registered\", name); }\ncatch (ViewCreationException ex) { logger.LogError(ex.InnerException, \"View creation failed\"); }","preventionTips":["Register all navigable views in App.RegisterTypes via RegisterForNavigation.","Centralize view names in constants to avoid typos.","Ensure modules registering views are initialized before navigation."],"tags":["prism","view-registry","navigation","key-not-found"],"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"}