Search Issue Tracker
Active
Under Consideration for 2021.3.X, 2022.3.X
Votes
0
Found in
2021.3.40f1
2022.3.38f1
6000.0.11f1
7000.0.0a1
Issue ID
UUM-76308
Regression
No
NativeArray with Allocator.Temp is disposed when used with Async/Await
Steps to reproduce:
1. Create a new project
2. Download and import the attached script "TempAllocatorAccess.cs"
3. Assign the script to a new GameObject
4. Enter Play Mode
5. Observe the console error "ObjectDisposedException: Cannot access a disposed object."
Expected Results: NativeArray with Allocator.Temp is not disposed when used with Async/Await
Actual Results: NativeArray with Allocator.Temp is disposed when used with Async/Await
Reproducible on: 2021.3.40f1, 2022.3.38f1, 6000.0.11f1
Testing Environment: Windows 11
Not reproducible on: No other environment tested
Notes:
-Full console errors:
Error accessing collection after awaiting: The Unity.Collections.NativeArray`1[System.Int32] has been deallocated, it is not allowed to access it
UnityEngine.Debug:LogError (object)
TempCollectionAccess/<Initialize>d__0:MoveNext () (at Assets/TempCollectionAccess.cs:33)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()
-
ObjectDisposedException: Cannot access a disposed object.
Object name: 'The NativeArray has been disposed, it is not allowed to access it'.
Unity.Collections.NativeArray`1[T].Dispose () (at <2d8783c7af0442318483a199a473c55b>:0)
TempCollectionAccess.Initialize () (at Assets/TempCollectionAccess.cs:37)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <c0b7b90d34a54066a7234dad69255116>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <2d8783c7af0442318483a199a473c55b>:0)
UnityEngine.UnitySynchronizationContext.Exec () (at <2d8783c7af0442318483a199a473c55b>:0)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <2d8783c7af0442318483a199a473c55b>:0)
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Select Preset "None" icon changes after switching tabs
- [Android] Crash when using xxHash3 and targeting the ARMv7 Architecture with IL2CPP Scripting Backend
- GameObject reference in a Script Component becomes missing when unpacking a variant of another Prefab variant
- Project Settings vertical separator position is not synchronized with the mouse position when dragging it horizontally
- Crash on PhysicsDebugDraw::SelectFiltering::Update when entering play mode with Physics Debug window docked and unfocused
Add comment