Code inspection: Accessing managed indexers is not supported
This inspection detects attempts to use indexers (e.g., obj[index]) on managed objects (classes) within a method compiled with Unity's Burst compiler.
Burst is designed for high-performance code and only supports a subset of C# that is "blittable" and avoids managed objects and garbage collection. Since managed classes are stored on the heap and require garbage collection, they cannot be safely accessed inside Burst-compiled code.
How it works
The analyzer monitors all element access expression nodes (code like myList[0] or myDictionary["key"]) within a Burst-compiled context (e.g., a Job with the [BurstCompile] attribute).
It resolves the element access to its underlying property (the indexer) and checks the containing type. If the containing type is a class (managed type) and not a standard C# array (which has special handling in Burst), it triggers the warning.
Example
In this example, the managedList[0] access is flagged because List<T> is a managed class. Replacing it with a NativeArray<T> resolves the issue as it is a blittable struct.