{"record":{"id":"e605a20feca51e19","repo":"stride3d/stride","slug":"this-operation-is-not-supported","errorCode":null,"errorMessage":"This operation is not supported.","messagePattern":"This operation is not supported\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/editor/Stride.Assets.Presentation/AssetEditors/EntityHierarchyEditor/Game/EditorGameEntitySelectionService.cs","lineNumber":392,"sourceCode":"                        break;\n                    case NotifyCollectionChangedAction.Remove:\n                        foreach (EntityHierarchyItemViewModel oldItem in e.OldItems)\n                        {\n                            var root = oldItem as SceneRootViewModel;\n                            if (root != null)\n                                RemoveFromSelection(root);\n                            else\n                                foreach (var entity in oldItem.InnerSubEntities)\n                                    RemoveFromSelection(entity);\n                        }\n                        break;\n                    case NotifyCollectionChangedAction.Reset:\n                        SelectedIds.Clear();\n                        SelectedRootIds.Clear();\n                        break;\n                    case NotifyCollectionChangedAction.Replace:\n                    case NotifyCollectionChangedAction.Move:\n                        throw new NotSupportedException(\"This operation is not supported.\");\n                    default:\n                        throw new ArgumentOutOfRangeException();\n                }\n\n                RaiseSelectionUpdated(oldSelectionIds);\n            }\n        }\n\n        private void RaiseSelectionUpdated(IReadOnlyCollection<AbsoluteId> oldSelectionIds)\n        {\n            var newSelectionIds = GetSelectedRootIds();\n            Editor.Controller.InvokeAsync(() =>\n            {\n                var oldSelection = oldSelectionIds.Select(x => Editor.Controller.FindGameSidePart(x)).Cast<Entity>().NotNull().ToList();\n                var newSelection = newSelectionIds.Select(x => Editor.Controller.FindGameSidePart(x)).Cast<Entity>().NotNull().ToList();\n                SelectionUpdated?.Invoke(this, new EntitySelectionEventArgs(oldSelection, newSelection));\n            });\n        }","sourceCodeStart":374,"sourceCodeEnd":410,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/editor/Stride.Assets.Presentation/AssetEditors/EntityHierarchyEditor/Game/EditorGameEntitySelectionService.cs#L374-L410","documentation":"EditorGameEntitySelectionService subscribes to selection collection changes and only supports Add/Remove/Reset actions; Replace or Move notifications on the selection collection are explicitly unsupported and throw NotSupportedException.","triggerScenarios":"Calling ObservableCollection.Move or replacing an item via the indexer (list[i] = x) on the selection collection the service monitors; any API that raises NotifyCollectionChangedAction.Replace or .Move.","commonSituations":"Custom tooling bulk-editing the selection by index replacement; data binding frameworks that replace items instead of removing/adding; third-party code assuming all collection mutations are allowed.","solutions":["Replace item replacement with explicit Remove + Add calls","Replace Move with Remove at old index followed by Insert at new index","Clear the collection and re-add the desired selection (maps to supported Reset)","Wrap any mass-selection mutation in Remove/Add sequences"],"exampleFix":"// before\nselectedItems[0] = newItem;               // Replace -> throws\n// after\nselectedItems.RemoveAt(0);\nselectedItems.Insert(0, newItem);          // supported Add/Remove","handlingStrategy":"validation","validationCode":"if (action == NotifyCollectionChangedAction.Replace || action == NotifyCollectionChangedAction.Move)\n    throw new NotSupportedException(\"Mutate the selection via Add/Remove/Clear only\");","typeGuard":null,"tryCatchPattern":"try { ApplySelectionChange(e); }\ncatch (NotSupportedException ex) { log.Warn(ex); RebuildSelectionFromSnapshot(); }","preventionTips":["Never use indexer assignment or Move on monitored selection collections","Use Add/Remove/Clear exclusively for selection edits","Centralize selection mutation in helper methods"],"tags":["csharp","collections","editor","selection"],"backgroundTag":"unsupported-operation","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}