{"record":{"id":"aa1bbc4ddc7a6e0b","repo":"lepoco/wpfui","slug":"unsupported-action-e-action","errorCode":null,"errorMessage":"Unsupported action: {e.Action}","messagePattern":"Unsupported action: (.+?)","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"warning","filePath":"src/Wpf.Ui/Controls/NavigationView/NavigationView.Base.cs","lineNumber":526,"sourceCode":"                _breadcrumbBarItems.Add(\n                    new NavigationViewBreadcrumbItem((INavigationViewItem)e.NewItems![0]!)\n                );\n                break;\n            case NotifyCollectionChangedAction.Remove:\n                _breadcrumbBarItems.RemoveAt(e.OldStartingIndex);\n                break;\n            case NotifyCollectionChangedAction.Replace:\n                _breadcrumbBarItems[0] = new NavigationViewBreadcrumbItem(\n                    (INavigationViewItem)e.NewItems![0]!\n                );\n                break;\n            case NotifyCollectionChangedAction.Move:\n                break;\n            case NotifyCollectionChangedAction.Reset:\n                _breadcrumbBarItems.Clear();\n                break;\n            default:\n                throw new ArgumentOutOfRangeException(nameof(e), e.Action, $\"Unsupported action: {e.Action}\");\n        }\n\n        UpdateBreadcrumbContents();\n    }\n\n    private void UpdateBreadcrumbContents()\n    {\n        foreach (var breadcrumbItem in _breadcrumbBarItems)\n        {\n            breadcrumbItem.UpdateFromSource();\n        }\n    }\n}\n","sourceCodeStart":508,"sourceCodeEnd":540,"githubUrl":"https://github.com/lepoco/wpfui/blob/ffebacd61058170cf63864b7d5aa730cffff848a/src/Wpf.Ui/Controls/NavigationView/NavigationView.Base.cs#L508-L540","documentation":"Thrown by NavigationView's NavigationStackOnCollectionChanged default branch when a NotifyCollectionChangedAction value is not Add/Remove/Replace/Move/Reset. The full enum is covered, so this is a defensive exhaustive-switch guard: it can only fire if a future .NET release adds a new action value, or a custom collection raises a fabricated action. Under normal use it is unreachable.","triggerScenarios":"The NavigationStack observable collection raises a CollectionChanged with an action outside the known enum set (e.g. a future-added enum member, or a custom collection passing an invalid cast integer to NotifyCollectionChangedEventArgs).","commonSituations":"Upgrading to a future .NET where INotifyCollectionChanged gains a new action; a custom navigation stack implementation that misuses NotifyCollectionChangedEventArgs; a corrupted/edge-case Replace where NewItems is null causing an earlier NRE rather than this throw.","solutions":["Use the built-in NavigationView navigation journal rather than mutating the stack with custom actions.","If you supply a custom collection, only raise Add/Remove/Replace/Move/Reset.","On .NET upgrade, check the INotifyCollectionChanged changelog for new actions and update accordingly.","Treat hitting this throw as a sign of an unsupported collection mutation pattern, not a runtime bug to retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* navigation stack mutation */ }\ncatch (ArgumentOutOfRangeException ex) when (ex.Message.Contains(\"Unsupported action\"))\n{\n    Logger.Error($\"Unsupported collection action raised: {ex.Message}\");\n}","preventionTips":["Mutate the navigation stack only through NavigationView's own APIs.","If supplying a custom collection, raise only Add/Remove/Replace/Move/Reset.","Treat this throw as a signal of misuse, not a transient error."],"tags":["wpf","navigationview","defensive-guard","exhaustive-switch"],"backgroundTag":null,"analyzedSha":"ffebacd61058170cf63864b7d5aa730cffff848a","analyzedAt":"2026-08-13T21:36:01.370Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}