Unity Hanging/Freezing, cannot use standard VS Studio debugging

I have been developing a 2D card game as a beginner and have run into an issue where Unity freezes after a period of time during runtime. I cannot discern where this happens and have used the debugging tool inside of VS Studio in an attempt to figure out whether or not it is an infinite loop (either through while loops or coroutines).

Attaching VS Studio to Unity and hitting the “Break All” or pause icon leads a screen stating: “Frame not in module”, with varying call stacks.

Several times, I do remember the call stack having the following line:
int32 system.threading.waithandle:waitone native

After failing to use the VS Studio Debugger, I turned to this Unity Discussions post:

I installed and followed the guide, resulting in the following results:

Seems like the main culprit is some WaitForAlertByThread, but I am not experienced enough to debug using this piece of software.

If anyone could give this problem a go I would be greatly appreciative.

I always assume these lockups are in MY code, and I find that scattering breakpoints all over kingdom come, which all fire all the time, to be an absolutely uselessly braindead way to debug a low-frequency infinite loop lockup in Unity3D.

So usually I write a little module to keep my loop counts modest and reasonable.

I found one and cleaned it up and stuck it here:

Put a call to BREAKOUT.Check(); in every suspect loop in your code and run.

Once you find and fix the crash, remove the calls.

1 Like

Thank you for the response. I have changed around some stuff and have not run into further issues fortunately, but if any other hanging/freezing issues come up i’ll be sure to use this method you outlined here.

1 Like