Search Issue Tracker
Active
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
6000.5.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
- Console shows Exception: {"error":"not found","detail":["not found"]} after opening Build History window
- [HDRP] Volumetric cloud shadows disappear when there is no directional light shadows
- “Selector” column names in the Search window are lowercase when added
- Install List Project Counter Panel can be right clicked through and Install Context Menu can be opened disabling Project Counter Panel's buttons
- [MacOS] Scene is marked/flickering as dirty (with asterisk) when dragging a Material on a GameObject in Scene view
Add comment