stride3d/stride · error · NotSupportedException
Unable to set the node value, the collection is unsupported
Error message
Unable to set the node value, the collection is unsupported
What it means
Add attempts to insert an item into the node's underlying collection, but the collection's descriptor does not support the Add operation (e.g. it is not a list/array-like collection with a known Add strategy). The library throws NotSupportedException because the value cannot be applied to this kind of collection. This is an API-usage/unsupported-collection error, not a data error.
Solutions
- Verify the underlying type actually supports Add (IList, array with resize semantics, registered ICollectionDescriptor)
- Register a custom ITypeDescriptor/CollectionDescriptor that implements Add for your custom collection type
- Replace the collection with a mutable, descriptor-supported type before mutating via the node
- Use Update on existing indices instead of Add when the collection has fixed size (e.g. arrays)
Example fix
// before node.Add(newItem, index); // NotSupportedException on ImmutableList // after var newList = immutableList.Add(newItem); node.Update(newList); // replace the whole value for unsupported collections
Defensive patterns
Strategy: try-catch
Validate before calling
if (node.Descriptor is ICollectionDescriptor cd && !cd.SupportsAdd) throw new InvalidOperationException("Collection does not support Add"); Type guard
static bool CollectionSupportsAdd(object collection) => collection is System.Collections.IList || collection is System.Collections.Generic.ICollection<object>;
Try / catch
try { node.Add(newItem, index); }
catch (NotSupportedException ex) when (ex.Message.Contains("collection is unsupported"))
{ /* replace the whole value via Update or mutate the source collection and refresh */ } Prevention
- Only Add via nodes whose underlying collection is mutable and descriptor-supported
- Register ICollectionDescriptor implementations for custom collection types
- For fixed-size or immutable collections, replace the whole value with Update instead of Add
When it happens
Trigger: Calling Add(object, NodeIndex) (or the value-update path that routes into it) on a node whose collection descriptor has no Add implementation — e.g. an immutable collection, an IDictionary-like type without a compatible overload, or a non-collection value node.
Common situations: Attempting to add items to readonly arrays, immutable lists (ImmutableArray/ImmutableList), or custom collections without a registered ICollectionDescriptor; treating a plain object node as a collection; custom type descriptors that did not implement Add.
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
- Two bundles with name
- content reference(s) were not rooted (see errors above)…
- Cyclic dependency found, involving
- No Collection item identifier associated to the given…
- An item has been added to a collection that does not have a…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/01e64df2749c1e44.
Report an issue: GitHub.
Appendix: source
Thrown at sources/presentation/Stride.Core.Quantum/ObjectNode.cs:109
NodeIndex index = NodeIndex.Empty;
switch (collectionDescriptor.Category)
{
case DescriptorCategory.List:
index = new NodeIndex(collectionDescriptor.GetCollectionCount(value));
break;
case DescriptorCategory.Set:
index = new NodeIndex(newItem);
break;
}
var args = new ItemChangeEventArgs(this, index, ContentChangeType.CollectionAdd, null, newItem);
NotifyItemChanging(args);
collectionDescriptor.Add(value, newItem);
UpdateReferences();
NotifyItemChanged(args);
}
else
{
throw new NotSupportedException("Unable to set the node value, the collection is unsupported");
}
}
/// <inheritdoc/>
public void Add(object newItem, NodeIndex itemIndex)
{
if (Descriptor is CollectionDescriptor collectionDescriptor)
{
var index = collectionDescriptor.Category == DescriptorCategory.Collection
? NodeIndex.Empty
: itemIndex;
var args = new ItemChangeEventArgs(this, index, ContentChangeType.CollectionAdd, null, newItem);
NotifyItemChanging(args);
if (!collectionDescriptor.HasInsert || collectionDescriptor.GetCollectionCount(value) == itemIndex.Int)
{
collectionDescriptor.Add(value, newItem);
}
elseView on GitHub (pinned to 96fad776d2)