stride3d/stride · error · NotSupportedException

This operation is not supported by the source tracker.

Error message

This operation is not supported by the source tracker.

What it means

When the tracked asset collection raises a change of an unexpected kind, AssetSourceTracker's Assets_CollectionChanged handler falls into the default branch and throws NotSupportedException. The tracker only supports the specific NotifyCollectionChanged Add/Remove/Replace/Reset actions it handles; anything else is a programming/incompatibility signal.

Solutions

  1. Only raise standard Add/Remove/Replace/Reset collection-changed events on the tracked collection
  2. Update Stride so both the tracker and collection come from the same version
  3. Inspect the event args action at the throw site and add explicit handling if you truly need a new action
  4. Avoid manually raising NotifyCollectionChanged events; mutate the collection through its normal API

Example fix

// before
collection.OnEvent(new NotifyCollectionChangedEventArgs((NotifyCollectionChangedAction)99));
// after
collection.Add(newAsset); // uses a supported action handled by the tracker
Defensive patterns

Strategy: try-catch

Validate before calling

if (e.Action is not (NotifyCollectionChangedAction.Add or NotifyCollectionChangedAction.Remove or NotifyCollectionChangedAction.Replace or NotifyCollectionChangedAction.Reset))
    return; // or log before mutating the tracked collection

Try / catch

try { MutateAssets(collection); }
catch (NotSupportedException ex)
{
    Log.Warning("Unsupported collection change by the source tracker: {Message}", ex.Message);
}

Prevention

When it happens

Trigger: Raising a custom NotifyCollectionChangedEventArgs with an unusual action on the asset collection; a new/foreign collection implementation feeding the tracker with actions outside its switch; version drift where a new NotifyCollectionChangedAction was added upstream.

Common situations: Custom asset collections in editor tooling; firing collection-changed events manually for testing; binding the tracker to a collection type it was not designed for.

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/48db6876d9c73bb1. Report an issue: GitHub.

Appendix: source

Thrown at sources/assets/Stride.Core.Assets/Tracking/AssetSourceTracker.cs:435

                            {
                                // Untrack assets that are currently tracked, but absent from the package session.
                                if (!allAssetIds.Contains(asset.Key))
                                    assetsToUntrack.Add(asset.Key);
                            }
                            foreach (var asset in assetsToUntrack)
                            {
                                UnTrackAsset(asset);
                            }
                            // Track assets that are present in the package session, but not currently in the list of tracked assets.
                            allAssetIds.ExceptWith(trackedAssets.Keys);
                            foreach (var asset in allAssetIds)
                            {
                                TrackAsset(asset);
                            }
                        }
                        break;
                    default:
                        throw new NotSupportedException("This operation is not supported by the source tracker.");
                }
            }
        }
    }

    private void DirectoryWatcher_Modified(object? sender, FileEvent e)
    {
        // If tracking is not enabled, don't bother to track files on disk
        if (!EnableTracking)
            return;

        // Store only the most recent events
        lock (fileEvents)
        {
            fileEvents.Add(e);
        }
    }

View on GitHub (pinned to 96fad776d2)