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

  1. Inspect the InnerException to identify which listener failed and fix it.
  2. Wrap listener logic in error handling so a single behavior doesn't break region updates.
  3. Call UpdateRegions only after the container and region adapters are registered.
  4. 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

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


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)