stride3d/stride · error · NotSupportedException
This operation is not supported.
Error message
This operation is not supported.
What it means
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.
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
Example fix
// before selectedItems[0] = newItem; // Replace -> throws // after selectedItems.RemoveAt(0); selectedItems.Insert(0, newItem); // supported Add/Remove
Defensive patterns
Strategy: validation
Validate before calling
if (action == NotifyCollectionChangedAction.Replace || action == NotifyCollectionChangedAction.Move)
throw new NotSupportedException("Mutate the selection via Add/Remove/Clear only"); Try / catch
try { ApplySelectionChange(e); }
catch (NotSupportedException ex) { log.Warn(ex); RebuildSelectionFromSnapshot(); } Prevention
- Never use indexer assignment or Move on monitored selection collections
- Use Add/Remove/Clear exclusively for selection edits
- Centralize selection mutation in helper methods
When it happens
Trigger: 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.
Common situations: 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.
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
- This operation is not supported by the source tracker.
- An item with the same key has already been added.
- The given key was not present in the dictionary.
- Internal error, the collection has already muted to a…
- The given item does not validate the collection constraint.
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/e605a20feca51e19.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.Assets.Presentation/AssetEditors/EntityHierarchyEditor/Game/EditorGameEntitySelectionService.cs:392
break;
case NotifyCollectionChangedAction.Remove:
foreach (EntityHierarchyItemViewModel oldItem in e.OldItems)
{
var root = oldItem as SceneRootViewModel;
if (root != null)
RemoveFromSelection(root);
else
foreach (var entity in oldItem.InnerSubEntities)
RemoveFromSelection(entity);
}
break;
case NotifyCollectionChangedAction.Reset:
SelectedIds.Clear();
SelectedRootIds.Clear();
break;
case NotifyCollectionChangedAction.Replace:
case NotifyCollectionChangedAction.Move:
throw new NotSupportedException("This operation is not supported.");
default:
throw new ArgumentOutOfRangeException();
}
RaiseSelectionUpdated(oldSelectionIds);
}
}
private void RaiseSelectionUpdated(IReadOnlyCollection<AbsoluteId> oldSelectionIds)
{
var newSelectionIds = GetSelectedRootIds();
Editor.Controller.InvokeAsync(() =>
{
var oldSelection = oldSelectionIds.Select(x => Editor.Controller.FindGameSidePart(x)).Cast<Entity>().NotNull().ToList();
var newSelection = newSelectionIds.Select(x => Editor.Controller.FindGameSidePart(x)).Cast<Entity>().NotNull().ToList();
SelectionUpdated?.Invoke(this, new EntitySelectionEventArgs(oldSelection, newSelection));
});
}View on GitHub (pinned to 96fad776d2)