{"record":{"id":"1ea9919412564ce2","repo":"stride3d/stride","slug":"collections-that-do-not-have-indexer-accessors-are-not","errorCode":null,"errorMessage":"Collections that do not have indexer accessors are not supported in Quantum.","messagePattern":"Collections that do not have indexer accessors are not supported in Quantum\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Quantum/DefaultNodeBuilder.cs","lineNumber":91,"sourceCode":"        }\n\n        if (!PrimitiveTypeFilter.IsPrimitiveType(currentDescriptor.Type))\n        {\n            base.VisitObject(obj, descriptor, true);\n        }\n\n        if (isRootNode)\n        {\n            PopContextNode();\n            rootNode!.Seal();\n        }\n    }\n\n    /// <inheritdoc/>\n    public override void VisitCollection(IEnumerable collection, CollectionDescriptor descriptor)\n    {\n        if (!descriptor.HasIndexerAccessors)\n            throw new NotSupportedException(\"Collections that do not have indexer accessors are not supported in Quantum.\");\n\n        // Don't visit items unless they are primitive or enumerable (collections within collections)\n        if (IsCollection(descriptor.ElementType))\n        {\n            base.VisitCollection(collection, descriptor);\n        }\n    }\n\n    /// <inheritdoc/>\n    public override void VisitDictionary(object dictionary, DictionaryDescriptor descriptor)\n    {\n        if (!PrimitiveTypeFilter.IsPrimitiveType(descriptor.KeyType))\n            throw new InvalidOperationException(\"The type of dictionary key must be a primary type.\");\n\n        // Don't visit items unless they are primitive or enumerable (collections within collections)\n        if (IsCollection(descriptor.ValueType))\n        {\n            base.VisitDictionary(dictionary, descriptor);","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Quantum/DefaultNodeBuilder.cs#L73-L109","documentation":"DefaultNodeBuilder.VisitCollection throws NotSupportedException because Quantum graph nodes require collections to expose indexer accessors so individual items can be addressed and observed. Collections without indexers cannot be represented in the node graph.","triggerScenarios":"Building a node graph (Build/Visit) over a property or field whose type is IEnumerable-like but lacks an indexer, e.g. HashSet<T>, ISet<T>, or a custom IEnumerable<T> without this[int]/this[key].","commonSituations":"Exposing HashSet<T> or a custom collection in a model bound to Quantum; replacing a List<T> property with a set type; third-party collection types without indexer accessors.","solutions":["Replace the collection with an indexer-backed type (List<T>, T[], Dictionary<K,V>, ObservableCollection<T>)","Implement indexer accessors on your custom collection so its CollectionDescriptor reports HasIndexerAccessors","Keep non-indexed collections out of the observed graph; wrap them in an indexed container","Catch NotSupportedException during Build and fall back to manual handling of that member"],"exampleFix":"// before\npublic HashSet<string> Tags { get; } = new HashSet<string>();\n// after\npublic ObservableCollection<string> Tags { get; } = new ObservableCollection<string>();","handlingStrategy":"validation","validationCode":"var d = TypeDescriptorFactory.Default.Find(coll.GetType()); if (d is CollectionDescriptor cd && !cd.HasIndexerAccessors) throw new InvalidOperationException($\"{coll.GetType()} has no indexer accessors\");","typeGuard":"bool IsQuantumCompatible<T>(T c) => c is IList || c is System.Collections.IDictionary || c is Array;","tryCatchPattern":"try { container.Build(root); } catch (NotSupportedException ex) { logger.LogError(ex, \"Unsupported collection in model\"); }","preventionTips":["Prefer IList<T>, arrays, or ObservableCollection<T> in observed models","Check HasIndexerAccessors on new collection types before binding them","Keep sets/non-indexed collections out of Quantum-observed properties"],"tags":["quantum","collections","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}