stride3d/stride · error · InvalidOperationException

Cyclic dependency found, involving

Error message

Cyclic dependency found, involving {0}

What it means

In Update, after set-dictionary handling, only CollectionBaseDescriptor nodes support item assignment; if the Descriptor is anything else the method throws NotSupportedException. This catches updates routed to node kinds with no settable item semantics.

Solutions

  1. Route dictionary item updates through the dictionary-specific path/descriptor instead of Update.
  2. Confirm the node's Descriptor is a CollectionBaseDescriptor before updating items.
  3. For non-collection nodes, update members via MemberNode APIs rather than indexed Update.

Example fix

// before
node.Update(newValue, NodeIndex.Create(dictKey), true); // node is a dictionary
// after
if (node.Descriptor is DictionaryDescriptor dd)
    dd.SetValue? /* use dictionary update path */ : node.Update(newValue, NodeIndex.Create(dictKey), true);
Defensive patterns

Strategy: validation

Validate before calling

if (node.Descriptor is not CollectionBaseDescriptor)
    throw new InvalidOperationException($"Update not supported for descriptor {node.Descriptor?.GetType().Name}");

Type guard

bool SupportsIndexedUpdate(ObjectNode node) => node.Descriptor is CollectionBaseDescriptor;

Try / catch

try { node.Update(newValue, index, true); }
catch (NotSupportedException ex) { /* route to dictionary or member update path depending on descriptor */ }

Prevention

When it happens

Trigger: Calling ObjectNode.Update(newValue, index, sendNotification) on a node whose Descriptor is a DictionaryDescriptor or is not a CollectionBaseDescriptor — e.g. updating items of a dictionary through the collection path, or updating a plain-object node with an index.

Common situations: Generic property-update pipelines that route both dictionary and list changes through Update; updating items of custom collection types lacking a CollectionBaseDescriptor.

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

Appendix: source

Thrown at sources/assets/Stride.AssetCompiler/BundlePacker.cs:479

        {
            var result = new List<T>();
            var temporaryMark = new HashSet<T>();
            var mark = new HashSet<T>();

            foreach (var item in source)
                TopologicalSortVisit(item, temporaryMark, mark, result, dependencies);

            return result;
        }

        private static void TopologicalSortVisit<T>(T item, HashSet<T> temporaryMark, HashSet<T> mark, List<T> result, Func<T, IEnumerable<T>> dependencies)
        {
            // Already processed?
            if (mark.Contains(item))
                return;

            if (temporaryMark.Contains(item))
                throw new InvalidOperationException(string.Format("Cyclic dependency found, involving {0}", item));

            temporaryMark.Add(item);

            foreach (var dep in dependencies(item))
                TopologicalSortVisit(dep, temporaryMark, mark, result, dependencies);

            mark.Add(item);
            result.Add(item);
        }
    }
}

View on GitHub (pinned to 96fad776d2)