PrismLibrary/Prism · error · InvalidOperationException
Navigation cannot proceed until a region is set for the…
Error message
Navigation cannot proceed until a region is set for the RegionNavigationService.
What it means
DoNavigate throws InvalidOperationException when the Region property has not been assigned. A RegionNavigationService is only usable once it is attached to a region (via IRegion.NavigationService); navigation cannot proceed without an owning region. This is a lifecycle/state error, not an argument error.
Solutions
- Always navigate through region.NavigationService obtained from an attached region (regionManager.Regions["Name"].NavigationService.RequestNavigate(...)).
- Ensure the region exists before navigating: check regionManager.Regions.ContainsRegionName("...").
- Make sure your custom IRegionAdapter registers the navigation behaviors so Region gets set before navigation.
Example fix
// before
var navService = container.Resolve<IRegionNavigationService>();
navService.RequestNavigate(new Uri("MainView", UriKind.Relative), r => { });
// after
var region = regionManager.Regions["ContentRegion"];
region.NavigationService.RequestNavigate(new Uri("MainView", UriKind.Relative), r => { }); Defensive patterns
Strategy: validation
Validate before calling
if (!regionManager.Regions.ContainsRegionName("ContentRegion"))
throw new InvalidOperationException("Region not registered yet");
regionManager.Regions["ContentRegion"].NavigationService.RequestNavigate(uri, r => { }); Type guard
bool CanNavigate(IRegion region) => region is not null && region.NavigationService?.Region is not null;
Try / catch
try
{
region.NavigationService.RequestNavigate(uri, result => OnNavigated(result));
}
catch (InvalidOperationException)
{
// region not attached yet; defer navigation until region is available
} Prevention
- Navigate only through region.NavigationService from regionManager.Regions[...].
- Wait for the view hosting the region to load before navigating (e.g. OnLoaded).
- Ensure custom region adapters attach the navigation behaviors that set Region.
When it happens
Trigger: Calling RequestNavigate on a region navigation service that was created but never assigned to a region — e.g. resolving IRegionNavigationService from the container directly and navigating without setting Region.
Common situations: Manually resolving RegionNavigationService instead of getting it from region.NavigationService; region not yet attached during early app startup; custom region adapters that forget to attach the navigation service via region behaviors.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- The host has not yet been created. The Shell must first be…
- The page type ' ' is not supported.
- Unable to determine the current page.
- NavigationException.NoPageIsRegistered
- The builder does not implement IRegistryAware
AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15).
Data as JSON: /api/errors/410c937ddf16ad8d.
Report an issue: GitHub.
Appendix: source
Thrown at src/Maui/Prism.Maui/Navigation/Regions/Navigation/RegionNavigationService.cs:109
throw new ArgumentNullException(nameof(navigationCallback));
try
{
DoNavigate(target, navigationCallback, regionParameters);
}
catch (Exception e)
{
NotifyNavigationFailed(new NavigationContext(this, target), navigationCallback, e);
}
}
private void DoNavigate(Uri source, Action<NavigationResult> navigationCallback, INavigationParameters regionParameters)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
if (Region == null)
throw new InvalidOperationException(Resources.NavigationServiceHasNoRegion);
_currentNavigationContext = new NavigationContext(this, source, regionParameters);
// starts querying the active views
RequestCanNavigateFromOnCurrentlyActiveView(
_currentNavigationContext,
navigationCallback,
Region.ActiveViews.OfType<VisualElement>().ToArray(),
0);
}
private void RequestCanNavigateFromOnCurrentlyActiveView(
NavigationContext navigationContext,
Action<NavigationResult> navigationCallback,
VisualElement[] activeViews,
int currentViewIndex)
{
if (currentViewIndex < activeViews.Length)View on GitHub (pinned to 358118cd64)