stride3d/stride · error · NotSupportedException

Unable to retrieve the value at the given index, this…

Error message

Unable to retrieve the value at the given index, this collection is unsupported

What it means

Content.Retrieve throws NotSupportedException when it cannot retrieve a value at the given index: the value is neither the content's own value nor retrievable through the expected descriptor, meaning the underlying object is an unsupported collection/value shape.

Solutions

  1. Ensure the underlying collection exposes indexer accessors (switch to List<T>/array/Dictionary)
  2. Verify the value passed to Retrieve actually belongs to this content (correct root object)
  3. Update descriptors/type registrations so the descriptor matches the value's type
  4. Catch NotSupportedException and handle the member outside the Quantum graph

Example fix

// before
content.Retrieve(myHashSet, index); // no indexer
// after
var list = myCollection.ToList();
content.Retrieve(list, NodeIndex.New(i));
Defensive patterns

Strategy: validation

Validate before calling

var d = TypeDescriptorFactory.Default.Find(value.GetType()); if (d is CollectionDescriptor cd && !cd.HasIndexerAccessors) throw new InvalidOperationException($"Collection {value.GetType()} is unsupported for indexed retrieval");

Type guard

bool SupportsIndexedRetrieve(object v) => v is System.Collections.IList || v is System.Collections.IDictionary;

Try / catch

try { var v = content.Retrieve(value, index); } catch (NotSupportedException ex) { // handle member outside the graph }

Prevention

When it happens

Trigger: Calling Retrieve(value, index) on a Content where value's type resolves to the same descriptor but the value does not implement the indexer accessors needed (non-indexed collection or non-boxable type), so neither recursion branch applies.

Common situations: Accessing items of collections lacking indexer accessors through the Quantum API; descriptor mismatches after type changes; passing a wrong value object into Content retrieval APIs.

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

Appendix: source

Thrown at sources/presentation/Stride.Core.Quantum/Internal/Content.cs:39

    {
        if (!index.TryGetValue(out var indexValue))
            return value;

        ArgumentNullException.ThrowIfNull(value);

        if (descriptor is CollectionBaseDescriptor collectionBaseDescriptor)
        {
            return collectionBaseDescriptor.GetValue(value, indexValue);
        }

        // Try with the concrete type descriptor
        var objectDescriptor = TypeDescriptorFactory.Default.Find(value.GetType());
        if (objectDescriptor != descriptor)
        {
            return Retrieve(value, index, objectDescriptor);
        }

        throw new NotSupportedException("Unable to retrieve the value at the given index, this collection is unsupported");
    }
}

View on GitHub (pinned to 96fad776d2)