Reproduction steps:
1. Open the “NativeTextDispose“ project
2. Open the “SampleScene“ scene
3. Enter Play Mode
4. Observe the Console
Expected result: No errors
Actual result: 2 NullReferenceExceptions
Reproduced in: 1.2.4 (2021.3.0f1, 2021.3.27f1, 2022.2.0a15)
Not reproduced in: 1.2.4 (2022.2.0a16, 2022.3.4f1, 2023.1.1f1, 2023.2.0a21)
Reproduced using: Linux (by the reporter), macOS 13.4 (Intel)
First few lines of error #1:
System.NullReferenceException: Object reference not set to an instance of an object
This Exception was thrown from a job compiled with Burst, which has limited exception support.
#3 Unity.Collections.LowLevel.Unsafe.UnsafeText.set_Length(Unity.Collections.LowLevel.Unsafe.UnsafeText* this, int value) -> void_fa987e683e737f22e74ebd39ccd6c6ad
First few lines of error #2:
NullReferenceException: Object reference not set to an instance of an object
Unity.Collections.Unicode.Utf8ToUcs (Unity.Collections.Unicode+Rune& rune, System.Byte* buffer, System.Int32& index, System.Int32 capacity) (at Library/PackageCache/com.unity.collections@1.2.4/Unity.Collections/Unicode.cs:221)
Notes:
1. Not reproduced with NativeArray and NativeList
2. Could not test in Player (application not responding)