PrismLibrary/Prism · error · UpdateRegionsException
Resources.UpdateRegionException (formatted with…
Error message
Resources.UpdateRegionException (formatted with rootException)
What it means
RegionManager.UpdateRegions raises the UpdatingRegions notification so registered region behaviors re-evaluate pending region registrations. If a listener throws, the exception arrives as TargetInvocationException; Prism unwraps its root exception and rethrows it as UpdateRegionsException (formatted with Resources.UpdateRegionException), preserving the inner exception.
Solutions
- Inspect the InnerException to identify which listener failed and fix it.
- Wrap listener logic in error handling so a single behavior doesn't break region updates.
- Call UpdateRegions only after the container and region adapters are registered.
- Remove or fix stale region behavior registrations that reference unresolvable types.
Example fix
// before: listener throws NRE inside UpdateRegions
public void OnUpdatingRegions(object s, EventArgs e) => ResolveRegionAdapter(); // may throw
// after
public void OnUpdatingRegions(object s, EventArgs e)
{
try { ResolveRegionAdapter(); }
catch (Exception ex) { logger.LogError(ex, "region update listener failed"); }
} Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure listeners won't throw before calling
if (container is null || !container.IsRegistered<IRegionAdapter>()) throw new InvalidOperationException("Region adapters not configured"); Try / catch
try
{
RegionManager.UpdateRegions();
}
catch (UpdateRegionsException ex)
{
logger.LogError(ex.InnerException ?? ex, "UpdateRegions listener failed");
} Prevention
- Wrap every UpdatingRegions listener body in error handling.
- Call UpdateRegions only after the container is fully configured.
- Inspect InnerException to identify the failing listener.
When it happens
Trigger: Calling RegionManager.UpdateRegions() when one of the subscribed UpdatingRegions listeners (via UpdateRegions() event subscription) throws — the failure is wrapped in TargetInvocationException and rethrown as UpdateRegionsException.
Common situations: Custom region behavior or adapter throwing in its UpdateRegions handler; DI resolution failing inside a listener; timing calls to UpdateRegions before the container is fully configured.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Resources.OnViewRegisteredException (formatted with…
- Layout 's Children property is not empty. This control is…
- regionName
- regionTarget
- The object must be of type
AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15).
Data as JSON: /api/errors/62ef9bcaa642197f.
Report an issue: GitHub.
Appendix: source
Thrown at src/Maui/Prism.Maui/Navigation/Regions/Xaml/RegionManager.cs:234
}
/// <summary>
/// Notifies attached behaviors to update the region managers appropriately if needed to.
/// </summary>
/// <remarks>
/// This method is normally called internally, and there is usually no need to call this from user code.
/// </remarks>
public static void UpdateRegions()
{
try
{
updatingRegionsListeners.Raise(null, EventArgs.Empty);
}
catch (TargetInvocationException ex)
{
Exception rootException = ex.GetRootException();
throw new UpdateRegionsException(string.Format(CultureInfo.CurrentCulture,
Resources.UpdateRegionException, rootException), ex.InnerException);
}
}
}
View on GitHub (pinned to 358118cd64)