Hi,
We’ve experienced this bug in the latest Unity 2021 version where players were complaining about crashing when an exception occurred even if it was caught. Thankfully Windows Store now actually records stacktraces, so we could actually figure out why. It’s going into GetGfxDevice() which also logs a message alongside the lines of Graphics Device is null before the crash. I assume that GetGfxDevice()/GetCurrentRefreshRate() is not thread safe.
I’ve attached the full stacktrace, but here’s the relevant snippet:
“0” “UnityPlayer.dll” “DebugStringToFilePostprocessedStacktrace” “0x000000000000056A”
“1” “UnityPlayer.dll” “DebugStringToFile” “0x00000000000003C2”
“2” “UnityPlayer.dll” “DebugStringToFile_core::basic_string_char,core::StringStorageDefault_char_ _ _” “0x000000000000006C”
“3” “UnityPlayer.dll” “GetGfxDevice” “0x000000000000005B”
“4” “UnityPlayer.dll” “GetCurrentRefreshRate” “0x0000000000000020”
“5” “UnityPlayer.dll” “ScreenManagerMetro::GetCurrentResolution” “0x0000000000000031”
“6” “UnityPlayer.dll” “CrashReporting::CrashReporter::populateReportSharedData” “0x00000000000005D8”
“7” “UnityPlayer.dll” “CrashReporting::CrashReporter::HandleLog” “0x000000000000037D”
“8” “UnityPlayer.dll” “CrashReporting::CrashReporter::OnLogCallbackStatic” “0x000000000000001C”
We’ve had to disable exception capturing manually on Windows Store as a workaround.
#if UNITY_WSA
CrashReportHandler.enableCaptureExceptions = false;
#endif
It can be reproduced fairly easily, but I am a bit too busy to make a bug report so I’m just going to leave it here.
8926163–1223144–stacktrace.txt (4.28 KB)
Got the same for a long time.
Exception thrown at 0x00007FFCD7DF79D6 (UnityPlayer.dll) in Battle Tanks.exe: 0xC0000005: Access violation reading location 0x0000000000001E74.
UnityPlayer.dll!ScreenManagerMetro::GetCurrentResolution(void) Unknown
UnityPlayer.dll!CrashReporting::CrashReporter::PopulateReportSharedData(class CrashReporting::CrashReport &,bool) Unknown
UnityPlayer.dll!CrashReporting::CrashReporter::HandleLog(char const *,char const *,char const *,enum LogType) Unknown
UnityPlayer.dll!CrashReporting::CrashReporter::OnLogCallbackStatic(struct DebugStringToFileData const &,enum LogType,bool) Unknown
UnityPlayer.dll!DebugStringToFilePostprocessedStacktrace(struct DebugStringToFileData const &) Unknown
UnityPlayer.dll!DebugStringToFile(struct DebugStringToFileData const &) Unknown
UnityPlayer.dll!Scripting::LogExceptionFromManaged(class ScriptingExceptionPtr,int,char const *,bool,struct Scripting::LogExceptionFromMangedSettings const *) Unknown
UnityPlayer.dll!DebugLogHandler_CUSTOM_Internal_LogException(class ScriptingBackendNativeObjectPtrOpaque *,class ScriptingBackendNativeObjectPtrOpaque *) Unknown
> [Inline Frame] GameAssembly.dll!InterfaceActionInvoker2<Exception_t *,Object_tC12DECB6760A7F2CBF65D9DCF18D044C2D97152C *>::Invoke(unsigned short declaringInterface, Il2CppClass *) Line 118 C++
GameAssembly.dll!SerilogLogHandler_LogException_mF071DDF35A91E490A916AAE5D5F3DFBE079E241A(SerilogLogHandler_tEDA21EDA8180ED91B542BB538B502A4AFDD8042D * __this, Exception_t * ___0_exception, Object_tC12DECB6760A7F2CBF65D9DCF18D044C2D97152C * ___1_context, const MethodInfo * method) Line 6485 C++
GameAssembly.dll!Logger_LogException_m591AF39F0886DA44666068EDBBD3CCF07623CFBB(Logger_t608FFEA1E140B6BE2CCB01C86ACB219533C172A0 * __this, Exception_t * ___0_exception, Object_tC12DECB6760A7F2CBF65D9DCF18D044C2D97152C * ___1_context, const MethodInfo * method) Line 5500 C++
GameAssembly.dll!Debug_LogException_mAB3F4DC7297ED8FBB49DAA718B70E59A6B0171B0(Exception_t * ___0_exception, const MethodInfo * method) Line 14771 C++
GameAssembly.dll!UniTaskScheduler_PublishUnobservedTaskException_m9F6352174ED5654B0A9FB5562B6FF25A788B27D3(Exception_t * ___0_ex, const MethodInfo * method) Line 18410 C++
GameAssembly.dll!ExceptionHolder_Finalize_m5D7B937A4BDAA2DAE58B962B84BA69DB8C2BEBBF(ExceptionHolder_t877D929A153D46C3BDA043B4058034AF85FB73B1 * __this, const MethodInfo * method) Line 17003 C++
GameAssembly.dll!il2cpp::vm::Runtime::InvokeWithThrow(const MethodInfo * method, void * obj, void * * params) Line 579 C++
GameAssembly.dll!il2cpp::vm::Runtime::Invoke(const MethodInfo * method, void * obj, void * * params, Il2CppException * * exc) Line 564 C++
GameAssembly.dll!il2cpp::gc::GarbageCollector::RunFinalizer(void * obj, void * data) Line 170 C++
GameAssembly.dll!GC_invoke_finalizers() Line 1318 C
[Inline Frame] GameAssembly.dll!il2cpp::gc::GarbageCollector::InvokeFinalizers() Line 461 C++
GameAssembly.dll!il2cpp::gc::FinalizerThread(void * arg) Line 106 C++
GameAssembly.dll!il2cpp::os::Thread::RunWrapper(void * arg) Line 204 C++
GameAssembly.dll!il2cpp::os::ThreadStartWrapper(void * arg) Line 29 C++
[External Code]
sameng
November 7, 2024, 5:49am
3
Still happens on latest 2021.3.45.
Nasty bug, so glad someone posted this cause this was causing me so much grief.