Search Issue Tracker
Active
Under Consideration for 2022.3.X, 6000.0.X, 6000.1.X, 6000.2.X, 6000.3.X, 6000.4.X
Votes
3
Found in
2021.3.40f1
2022.3.38f1
6000.0.11f1
6000.1.0a7
6000.2.0a1
6000.3.0a1
6000.4.0a1
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
- Opening Terrain Prefab in Prefab Editing Mode throws "NullReferenceException" error
- [Search] Dragging query pills put them behind the search text field
- A CustomPropertyDrawer that returns a PropertyField for a property named the same as a child field will not render all child fields
- Graphics Settings shows default values instead of the real values in the Rendering Debugger when Volume.profile is assigned via script
- Deleting multiple Tags throws “NullReferenceException”, and "Retrieving array element that was out of bounds" errors when holding the Enter key
Add comment