Copyright © 2026 Unity Technologies
Reproduction steps:
1. Open the attached project “CrashRepro“
2. Build and run (File > Build And Run)
3. Click on any of the 3 buttons
Expected result: IL2CPP injects division by zero checks for integer division and throws managed DivideByZeroException exception
Actual result: The Player crashes
Reproducible with: 2021.3.29f1, 2022.3.7f1, 2023.1.7f1, 2023.2.0b2
Reproducible on: Windows 10
First few lines of stack trace:
0x00007FF9686F9E61 (GameAssembly) [C:\Users\klaid\Desktop\Cases\IN-50301_DivideByZero\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\Assembly-CSharp.cpp:833] DivisionByZeroTest_UseTryCatch_m68417933F30642B643323F59822402A214072BBE 0x00007FF9686F96BD (GameAssembly) [C:\Users\klaid\Desktop\Cases\IN-50301_DivideByZero\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\Assembly-CSharp.cpp:755] DivisionByZeroTest_OnGUI_m81204F7C81CC6FAFE1193B3642AE3711895B540C 0x00007FF96830D571 (GameAssembly) [C:\Users\klaid\Desktop\Cases\IN-50301_DivideByZero\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\Il2CppInvokerTable.cpp:13629] RuntimeInvoker_TrueVoid_t4861ACF8F4594C3437BB48B6E56783494B843915 0x00007FF96842AE62 (GameAssembly) [C:\Program Files\Unity\2022.3.7f1_b16b3b16c7a0\Data\il2cpp\libil2cpp\vm\Runtime.cpp:605] il2cpp::vm::Runtime::InvokeWithThrow 0x00007FF96842A452 (GameAssembly) [C:\Program Files\Unity\2022.3.7f1_b16b3b16c7a0\Data\il2cpp\libil2cpp\vm\Runtime.cpp:590] il2cpp::vm::Runtime::Invoke 0x00007FF9684917C2 (GameAssembly) [C:\Program Files\Unity\2022.3.7f1_b16b3b16c7a0\Data\il2cpp\libil2cpp\il2cpp-api.cpp:1128] il2cpp_runtime_invoke
Issues you vote on will appear here