Very strange deadlock on Exception.ToString
I am troubleshooting a strange issue occurring in a game engine I'm writing. Normally, when an exception occurs in either the tick or render thread, a third "watchdog" thread will log the exception and then attempt to gracefully exit the entire process.
This works as expected on my desktop, but I recently tried to run the engine on my laptop (I was missing some assets so it threw an exception) and it is deadlocking instead of exiting gracefully. The deadlock is perplexing me, because it's occurring inside of very low-down .NET runtime code.
If I hit "Break" in Visual Studio while it is deadlocked, I can see that the watchdog thread is hung on the following line in my logging code:
If I break apart that code into concatenation, it hangs on
I'm half tempted to file an issue on the
This works as expected on my desktop, but I recently tried to run the engine on my laptop (I was missing some assets so it threw an exception) and it is deadlocking instead of exiting gracefully. The deadlock is perplexing me, because it's occurring inside of very low-down .NET runtime code.
If I hit "Break" in Visual Studio while it is deadlocked, I can see that the watchdog thread is hung on the following line in my logging code:
If I break apart that code into concatenation, it hangs on
exception.ToString(). The full call stack is attached (too long to paste inline). The type that it's trying to load at TypeNameParser.GetType is System.Diagnostics.StackTraceSymbols. I confirmed using a breakpoint that my desktop computer (running the same source code on the same .NET Runtime version, 8.0.18) successfully passes this line of code and doesn't deadlock. The laptop deadlocks consistently every single time. Both machines are Windows 10 Professional x64 with Intel i7 processors (the laptop is significantly older, though).I'm half tempted to file an issue on the
dotnet/runtime GitHub, but I can't even begin to think of how to reproduce this or even document it. It's clearly dependent on CPU characteristics or something if it doesn't happen on my desktop.Call_Stack.txt6.76KB