stride3d/stride · error · NotSupportedException

Reset is not supported by the asset tracker.

Error message

Reset is not supported by the asset tracker.

What it means

AssetTracker.Assets_CollectionChanged throws NotSupportedException when the collection-changed action is Reset. The tracker processes Add/Remove notifications incrementally (TrackAsset/UnTrackAsset) and cannot reconstruct its state from a reset event, so it refuses.

Solutions

  1. Unsubscribe/dispose the AssetTracker before performing the Reset, then re-track afterwards.
  2. Replace Clear() with per-item Remove calls so the tracker sees Add/Remove events.
  3. Re-create the tracker after the reset so it starts from a clean snapshot.

Example fix

// before
assetCollection.Clear(); // raises Reset -> tracker throws
// after
foreach (var item in assetCollection.ToList()) assetCollection.Remove(item);
Defensive patterns

Strategy: try-catch

Validate before calling

if (e.Action == NotifyCollectionChangedAction.Reset) tracker.Dispose(); // detach before reset

Try / catch

try { assets.Clear(); } catch (NotSupportedException ex) when (ex.Message.Contains("Reset is not supported")) { // untrack, clear, recreate tracker
tracker.Dispose(); assets.Clear(); tracker = new AssetTracker(...); }

Prevention

When it happens

Trigger: Raising NotifyCollectionChangedAction.Reset on the tracked asset collection while an AssetTracker is subscribed — e.g. Clear() implementations that fire Reset instead of per-item Remove events.

Common situations: Bulk-clearing an AssetCollection whose implementation signals Reset; reassigning the collection's contents in one operation while tracking is active.

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


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/86072f6ef17256aa. Report an issue: GitHub.

Appendix: source

Thrown at sources/assets/Stride.Core.Assets/AssetTracker.cs:162

    private void Assets_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
    {
        switch (e.Action)
        {
            case NotifyCollectionChangedAction.Add:
                foreach (var assetItem in e.NewItems?.OfType<AssetItem>() ?? [])
                {
                    TrackAsset(assetItem);
                }
                break;
            case NotifyCollectionChangedAction.Remove:
                foreach (var assetItem in e.OldItems?.OfType<AssetItem>() ?? [])
                {
                    UnTrackAsset(assetItem);
                }
                break;
            default:
                throw new NotSupportedException("Reset is not supported by the asset tracker.");
        }
    }
}

View on GitHub (pinned to 96fad776d2)