PrismLibrary/Prism · error · KeyNotFoundException
No registration found for the Region View
Error message
No registration found for the Region View '{viewType.FullName}'. What it means
RegionViewRegistry.RegisterViewWithRegion(Type) resolves a factory that looks up the view type in IRegionNavigationRegistry.Registrations; if no Region-type registration matches the viewType, a KeyNotFoundException with the view's full name is thrown. The view must first be registered (via ViewType.Region registration) before the region registry can create it.
Solutions
- Register the view: navigationBuilder.RegisterView<TView>(...) / RegisterForNavigation<TView>() so a Region-type registration exists.
- Verify the exact Type passed to RegisterViewWithRegion matches the registered type (same assembly and full name).
- Check that the assembly containing the view is scanned/loaded; ensure IRegionNavigationRegistry contains the expected entry.
Example fix
// before
containerRegistry.RegisterViewWithRegion("MainRegion", typeof(UndefinedView)); // never registered
// after
containerRegistry.RegisterForNavigation<MainView>("MainView");
containerRegistry.RegisterViewWithRegion("MainRegion", typeof(MainView)); Defensive patterns
Strategy: try-catch
Validate before calling
var registered = container.Resolve<IRegionNavigationRegistry>()
.Registrations.Any(x => x.Type == ViewType.Region && x.View == viewType);
if (!registered)
throw new InvalidOperationException($"{viewType.FullName} is not registered as a region view"); Type guard
bool IsRegisteredRegionView(IRegionNavigationRegistry reg, Type t) =>
reg.Registrations.Any(x => x.Type == ViewType.Region && x.View == t); Try / catch
try { registry.RegisterViewWithRegion(regionName, viewType); }
catch (KeyNotFoundException ex) { Console.WriteLine($"Missing registration: {ex.Message}"); } Prevention
- Always call RegisterForNavigation/RegisterView before RegisterViewWithRegion(Type)
- Verify the Type matches the registered one after refactors
- Confirm view assemblies are included in registration scanning
When it happens
Trigger: Calling containerProvider.Resolve ... or regionViewRegistry.RegisterViewWithRegion(regionName, typeof(SomeView)) when SomeView was never registered in the DI/region registry (missing navigation registration, e.g. never registered via RegisterForNavigation with Region view type).
Common situations: Forgetting a RegisterForNavigation/registration call during App.RegisterTypes or App.CreateWindow; renaming/moving the view class so the stored registration's Type no longer matches; assembly scanning not including the view's assembly.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Layout 's Children property is not empty. This control is…
- regionName
- regionTarget
- The object must be of type
- Mapping with the given type is already registered
AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15).
Data as JSON: /api/errors/4cb7258ef94b66fa.
Report an issue: GitHub.
Appendix: source
Thrown at src/Maui/Prism.Maui/Navigation/Regions/RegionViewRegistry.cs:57
items.Add(getContentDelegate(container));
}
return items;
}
/// <summary>
/// Registers a content type with a region name.
/// </summary>
/// <param name="regionName">Region name to which the <paramref name="viewType"/> will be registered.</param>
/// <param name="viewType">Content type to be registered for the <paramref name="regionName"/>.</param>
public void RegisterViewWithRegion(string regionName, Type viewType)
{
RegisterViewWithRegion(regionName, c =>
{
var registry = c.Resolve<IRegionNavigationRegistry>();
var registration = registry.Registrations.FirstOrDefault(x => x.Type == ViewType.Region && x.View == viewType);
if (registration is null)
throw new KeyNotFoundException($"No registration found for the Region View '{viewType.FullName}'.");
return registry.CreateView(c, registration.Name);
});
}
/// <summary>
/// Registers a content type with a region name.
/// </summary>
/// <param name="regionName">Region name to which the <paramref name="targetName"/> will be registered.</param>
/// <param name="targetName">Content type to be registered for the <paramref name="regionName"/>.</param>
public void RegisterViewWithRegion(string regionName, string targetName)
{
RegisterViewWithRegion(regionName, c =>
{
var registry = c.Resolve<IRegionNavigationRegistry>();
return registry.CreateView(c, targetName);
});
}View on GitHub (pinned to 358118cd64)