PrismLibrary/Prism · error · Exception
Region not Found
Error message
Region not Found
What it means
After resolving Regions[regionName], RequestNavigate throws a plain Exception("Region not Found") when the indexer returns null — the name is valid as a key lookup but no region is registered under it. The exception is caught internally and delivered as a failed NavigationResult with the exception attached.
Solutions
- Inspect the NavigationResult in the callback and check result.Exception for the 'Region not Found' message.
- Verify the region exists (ContainsRegionWithName) and its host view is loaded before navigating.
- Use RegisterViewWithRegion so the region is created before navigation is requested.
Example fix
// before
regionManager.RequestNavigate("Details", uri, result => { });
// after
regionManager.RequestNavigate("Details", uri, result =>
{
if (!result.Success)
Console.WriteLine($"Navigation failed: {result.Exception?.Message}");
}); Defensive patterns
Strategy: try-catch
Validate before calling
if (!regionManager.Regions.ContainsRegionWithName(regionName))
throw new InvalidOperationException($"Region '{regionName}' not found"); Type guard
bool RegionExists(IRegionManager rm, string name) => rm.Regions.ContainsRegionWithName(name);
Try / catch
regionManager.RequestNavigate(regionName, target, result =>
{
if (!result.Success)
Console.WriteLine($"{result.Context ?? result.Exception?.Message}");
}, parameters); Prevention
- Check NavigationResult.Success on every navigation
- Ensure the target region's host view is loaded before navigating
- Track region lifetime relative to page navigation stack
When it happens
Trigger: Calling regionManager.RequestNavigate(regionName, uri, callback, parameters) where Regions.ContainsRegionWithName(regionName) is false; the callback receives a NavigationResult with Success == false and Context/Exception set.
Common situations: Navigating to a region in a view that hasn't been loaded/created yet; region name typo; region destroyed after its host page was popped from the navigation stack.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Resources.RegionNotFound (formatted with regionName)
- ArgumentNullException for 'regionName'
- The page type ' ' is not supported.
- Unable to determine the current page.
- NavigationException.NoPageIsRegistered
AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15).
Data as JSON: /api/errors/abf7d1da848f5a82.
Report an issue: GitHub.
Appendix: source
Thrown at src/Maui/Prism.Maui/Navigation/Regions/RegionManager.cs:137
/// <summary>
/// This method allows an <see cref="IRegionManager"/> to locate a specified region and navigate in it to the specified target <see cref="Uri"/>, passing a navigation callback and an instance of <see cref="INavigationParameters"/>, which holds a collection of object parameters.
/// </summary>
/// <param name="regionName">The name of the region where the navigation will occur.</param>
/// <param name="target">A <see cref="Uri"/> that represents the target where the region will navigate.</param>
/// <param name="navigationCallback">The navigation callback that will be executed after the navigation is completed.</param>
/// <param name="navigationParameters">An instance of <see cref="INavigationParameters"/>, which holds a collection of object parameters.</param>
public void RequestNavigate(string regionName, Uri target, Action<NavigationResult> navigationCallback, INavigationParameters navigationParameters)
{
try
{
if (string.IsNullOrEmpty(regionName))
throw new ArgumentNullException(nameof(regionName));
var region = Regions[regionName];
if (region is null)
throw new Exception("Region not Found");
region.NavigationService.RequestNavigate(target, navigationCallback, navigationParameters);
}
catch (Exception ex)
{
var navigationContext = new NavigationContext(null, target, navigationParameters);
navigationCallback?.Invoke(new NavigationResult(navigationContext, ex));
}
}
///// <summary>
///// Provides a new item for the region based on the supplied candidate target contract name.
///// </summary>
///// <param name="candidateTargetContract">The target contract to build.</param>
///// <returns>An instance of an item to put into the <see cref="IRegion"/>.</returns>
//protected virtual VisualElement CreateNewRegionItem(string candidateTargetContract)
//{
// tryView on GitHub (pinned to 358118cd64)