Unity Issue Tracker - DynamicBuffer's AsArray() returns an invalidated array when there are no structural changes
Closed
ECSB-231
DynamicBuffer's AsArray() returns an invalidated array when there are no structural changes
Package: Entity Component System (ECS)
Won't Fix
1.0.X
The structural change is AddRange() itself. The compiler doesn't know that buffer1 does not alias buffer2.
Reproduction steps:
1. Open user attached “repro-project”
2. Enter Play mode
3. Observe Console
Expected result: No errors in the Console
Actual result: “ObjectDisposedException: Attempted to access BufferLookup<SomeBuffer> which has been invalidated by a structural change.” error message in the Console
Reproduced with: 1.0.0-pre.44 (2022.2.9f1, 2023.1.0b6, 2023.2.0a5), 1.0.0-pre.47 (2022.2.9f1)
Could not test with: 1.0.0-pre.44 (2020.3.45f1, 2021.3.19f1) (too many errors)
Reproducible on: macOS 13.2.1 (Intel), Windows 10 (by the reporter)
Note: Not reproduced in Player
Prioritise and Follow this issue
Have a workaround or additional info about this issue?