Reproduction steps:
1. Open the attached “repro-project“
2. Open the Assets/Scenes/TestScene.unity scene
3. Build And Run
4. Observe the crash
Reproducible with: 2022.1.0a15, 2022.3.4f1, 2023.1.2f1, 2023.2.0a21
Not reproducible with: 2021.3.28f1, 2022.1.0a14
Reproduced on: Windows 10 Pro
Note: Not reproducible on Standalone Build
First few lines of the stack trace:
{{0x00007ff7c92a2ed3 (Unity) CachedWriter::Write }}
{{0x00007ff7c9678691 (Unity) StreamedBinaryWrite::TransferTypelessData }}
{{0x00007ff7c9092f1d (Unity) Texture2D::Transfer<StreamedBinaryWrite> }}
{{0x00007ff7c9662b57 (Unity) SerializedFile::WriteObject }}
0x00007ff7c964c377 (Unity) PersistentManager::WriteFile