stride3d/stride · error · InvalidOperationException
Reset is not supported on the tag collection.
Error message
Reset is not supported on the tag collection.
What it means
The Tags view model subscribes to its tag collection's CollectionChanged and translates Add/Remove events into edits on the underlying asset. A Reset action (the whole collection being cleared/replaced at once, e.g. via Clear() or a new assignment) carries no item-level information, so the handler throws InvalidOperationException instead of silently desynchronizing the asset's Tags.
Solutions
- Remove tags one by one instead of calling Clear(): iterate a snapshot and Remove each item.
- If you must clear many tags, wrap individual removals in a single undo/redo transaction so behavior and history stay correct.
- Never reassign or rebuild the exposed collection; mutate the existing one.
Example fix
// before
vm.Tags.Clear();
// after
using (vm.Session.UndoRedoService.CreateTransaction())
foreach (var tag in vm.Tags.ToList())
vm.Tags.Remove(tag); Defensive patterns
Strategy: try-catch
Validate before calling
// avoid Reset: remove items individually foreach (var tag in vm.Tags.ToList()) vm.Tags.Remove(tag);
Try / catch
try { MutateTags(vm, action); }
catch (InvalidOperationException ex) when (ex.Message.Contains("Reset")) { logger.Error(ex, "Use item-by-item tag removal instead of Clear()/Reset"); } Prevention
- Never call Clear() or reassign the exposed tag collection
- Wrap bulk tag edits in a single undo/redo transaction
- Prefer Remove per item so CollectionChanged carries item details
When it happens
Trigger: Calling Clear() on the exposed tag collection, or bulk-replacing it in a way that raises NotifyCollectionChangedAction.Reset instead of granular Add/Remove changes.
Common situations: Code bulk-clearing tags before re-adding them; data-binding frameworks firing Reset; test code that assigns a fresh collection.
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
- A category cannot be deleted
- A part Id cannot be empty.
- An asset [ ] with the same location [ ] is already…
- An asset with the same id
- An IMemberNode was expected when processing the path
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/f99905c346125793.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.Core.Assets.Editor/ViewModel/AssetViewModel.cs:679
if (Directory.Assets.Any(x => string.Equals(x.Name, newName, StringComparison.InvariantCultureIgnoreCase) && x != this))
{
error = string.Format(Tr._p("Message", "Unable to rename asset to '{0}' because an asset with the same name exists in the same directory"), newName);
return false;
}
if (string.IsNullOrWhiteSpace(newName))
{
error = Tr._p("Message", "Unable to rename asset with an empty name");
return false;
}
error = null;
return true;
}
private void TagsCollectionChanged(object sender, [NotNull] NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Reset)
{
throw new InvalidOperationException("Reset is not supported on the tag collection.");
}
if (e.OldItems != null)
{
foreach (string oldItem in e.OldItems)
{
assetItem.Asset.Tags.Remove(oldItem);
}
}
if (e.NewItems != null)
{
foreach (string newItem in e.NewItems)
{
assetItem.Asset.Tags.Add(newItem);
}
}
}
private void CreateDerivedAsset()View on GitHub (pinned to 96fad776d2)