{"record":{"id":"d5f77e0bcbd58351","repo":"PrismLibrary/Prism","slug":"deactivation-is-not-possible-in-this-type-of-region","errorCode":null,"errorMessage":"Deactivation is not possible in this type of region.","messagePattern":"Deactivation is not possible in this type of region\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Maui/Prism.Maui/Navigation/Regions/AllActiveRegion.cs","lineNumber":32,"sourceCode":"    public AllActiveRegion(IRegionNavigationService regionNavigationService)\n        : base(regionNavigationService)\n    {\n    }\n\n    /// <summary>\n    /// Gets a readonly view of the collection of all the active views in the region. These are all the added views.\n    /// </summary>\n    /// <value>An <see cref=\"IViewsCollection\"/> of all the active views.</value>\n    public override IViewsCollection ActiveViews => Views;\n\n    /// <summary>\n    /// Deactivate is not valid in this Region. This method will always throw <see cref=\"InvalidOperationException\"/>.\n    /// </summary>\n    /// <param name=\"view\">The view to deactivate.</param>\n    /// <exception cref=\"InvalidOperationException\">Every time this method is called.</exception>\n    public override void Deactivate(object view)\n    {\n        throw new InvalidOperationException(Resources.DeactiveNotPossibleException);\n    }\n}\n","sourceCodeStart":14,"sourceCodeEnd":35,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Maui/Prism.Maui/Navigation/Regions/AllActiveRegion.cs#L14-L35","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nregion.Deactivate(view);\n\n// after\nif (region is SingleActiveRegion)\n    region.Deactivate(view);\nelse\n    region.Remove(view);","handlingStrategy":"type-guard","validationCode":"bool canDeactivate = region is SingleActiveRegion;\nif (!canDeactivate) { /* skip or remove the view instead */ }","typeGuard":"bool SupportsDeactivation(IRegion region) => region is SingleActiveRegion;","tryCatchPattern":"try { region.Deactivate(view); }\ncatch (InvalidOperationException) { /* all-active region: use Remove instead */ }","preventionTips":["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"],"tags":["prism","maui","regions","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"358118cd640d9a22ff8cf21c8ad197fa038b7990","analyzedAt":"2026-09-15T15:00:31.079Z","contentChangedAt":"2026-09-15T15:00:31.079Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}