Reproduction steps:
1. Open the attached "crash_IN-58386.zip" project
2. Open the "/Assets/Scenes/SampleScene.unity"
3. Build the project with IL2CPP scripting backend ("File" > "Build Settings..." > "Build")
4. Once the build is complete, open the "ProcessIL2CPPCrash.exe" application, located in the build folder
5. Observe the crash
Reproduced with: 2021.3.32f1, 2022.3.13f1, 2023.1.19f1, 2023.2.0b17, 2023.3.0a13
Reproduced on: Windows 11 (10.0.22621) (user's), Windows 10 (22H2)
Not reproduced on: macOS Sonoma 14.0 (Intel)
Notes:
- The Player crashes as soon as "Process.HasExited" or "Process.EnableRaisingEvents = true" is called
- The user found a workaround, which is to use the "kernel32.dll" functions "OpenProcess" and "WaitForSingleObject"
First few lines of stack trace:
0x00007FF8B9DC4884 (GameAssembly) [\Data\il2cpp\libil2cpp\icalls\mscorlib\System.Threading\WaitHandle.cpp:73] il2cpp::icalls::mscorlib::System::Threading::WaitHandle::Wait_internal
0x00007FF8BA0B333A (GameAssembly) [\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\mscorlib__7.cpp:17155] WaitHandle_WaitOneNative_m5E01D22F3623A149BB9AAB34819BB5A4AD9A3B78
0x00007FF8BA0B34C9 (GameAssembly) [\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\mscorlib__7.cpp:16614] WaitHandle_WaitOne_mB14C7B13361C8F8D5C2A415B1DDD5AAC32F87E43
0x00007FF8BA11A70C (GameAssembly) [\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\System__2.cpp:17119] Process_get_HasExited_m579B038BCCBC4C468970D4CB171173FAB4FFA7C6
0x00007FF8B9DDC5B6 (GameAssembly) [\Data\il2cpp\libil2cpp\vm\Runtime.cpp:581] il2cpp::vm::Runtime::InvokeWithThrow