PrismLibrary/Prism · error · InvalidOperationException
Deactivation is not possible in this type of region.
Error message
Deactivation is not possible in this type of region.
What it means
AllActiveRegion keeps every added view active and does not support deactivation. Its Deactivate override unconditionally throws InvalidOperationException (Resources.DeactiveNotPossibleException). Deactivation is only meaningful in SingleActiveRegion-style regions.
Solutions
- Remove or conditionalize the Deactivate call — check the region type before deactivating (e.g. only call Deactivate when region is SingleActiveRegion)
- Use region.Remove(view) if the intent is to remove the view from the region instead of deactivating it
- If activation control is needed, change the region type/behavior for that control to a single-active region
Example fix
// before
region.Deactivate(view);
// after
if (region is SingleActiveRegion)
region.Deactivate(view);
else
region.Remove(view); Defensive patterns
Strategy: type-guard
Validate before calling
bool canDeactivate = region is SingleActiveRegion;
if (!canDeactivate) { /* skip or remove the view instead */ } Type guard
bool SupportsDeactivation(IRegion region) => region is SingleActiveRegion;
Try / catch
try { region.Deactivate(view); }
catch (InvalidOperationException) { /* all-active region: use Remove instead */ } Prevention
- Know your region's behavior type before calling Deactivate
- Use region.Remove(view) when you want views gone, not just inactive
- Centralize region navigation logic so region-type assumptions live in one place
When it happens
Trigger: Calling IRegion.Deactivate(view) on a region created by AllActiveRegion — e.g. region.Deactivate(someView) or navigation logic that attempts to deactivate views in a region adapted with an all-active adapter (like ContentPresenter/LayoutView regions configured as AllActiveRegion).
Common situations: Shared navigation/viewmodel code calling Deactivate on any region regardless of type; switching a region's adapter/behavior from single-active to all-active and existing deactivation calls now failing; navigation frameworks probing deactivation support.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 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/d5f77e0bcbd58351.
Report an issue: GitHub.
Appendix: source
Thrown at src/Maui/Prism.Maui/Navigation/Regions/AllActiveRegion.cs:32
public AllActiveRegion(IRegionNavigationService regionNavigationService)
: base(regionNavigationService)
{
}
/// <summary>
/// Gets a readonly view of the collection of all the active views in the region. These are all the added views.
/// </summary>
/// <value>An <see cref="IViewsCollection"/> of all the active views.</value>
public override IViewsCollection ActiveViews => Views;
/// <summary>
/// Deactivate is not valid in this Region. This method will always throw <see cref="InvalidOperationException"/>.
/// </summary>
/// <param name="view">The view to deactivate.</param>
/// <exception cref="InvalidOperationException">Every time this method is called.</exception>
public override void Deactivate(object view)
{
throw new InvalidOperationException(Resources.DeactiveNotPossibleException);
}
}
View on GitHub (pinned to 358118cd64)