How to reproduce:
1. Open the attached “IN-139100” project
2. Navigate to File > Build and Run
3. In the upper left corner, click on “Set Mesh“
4. Click on “Set flag0“ then “Set Mesh“ again
5. Observe the crash
Reproducible with: 6000.0.0a1, 6000.0.73f1, 6000.3.13f1, 6000.4.2f1, 6000.5.0b3, 6000.6.0a2
Reproduced on: Windows 10 (user reported), Windows 11
Not reproduced on: No other environment tested
Note: Not reproducible in the Editor
First few lines of the stack trace:
0x00007FFC94F788DC (UnityPlayer) UnityMain
0x00007FFC94A0F387 (UnityPlayer) (function-name not available)
0x000001C86357EC7A (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Mesh:SetAllSubMeshesAtOnceFromArray_Injected (intptr,UnityEngine.Bindings.ManagedSpanWrapper&,int,int,UnityEngine.Rendering.MeshUpdateFlags)
0x000001C86357EACB (Mono JIT Code) UnityEngine.Mesh:SetAllSubMeshesAtOnceFromArray (UnityEngine.Rendering.SubMeshDescriptor[],int,int,UnityEngine.Rendering.MeshUpdateFlags)
0x000001C86357E1C3 (Mono JIT Code) UnityEngine.Mesh:SetSubMeshes (UnityEngine.Rendering.SubMeshDescriptor[],int,int,UnityEngine.Rendering.MeshUpdateFlags)
0x000001C86357E04B (Mono JIT Code) UnityEngine.Mesh:SetSubMeshes (UnityEngine.Rendering.SubMeshDescriptor[],UnityEngine.Rendering.MeshUpdateFlags)