Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Official Debugging Editor freezes and hangs [Windows Only]

Discussion in 'Windows' started by Unity_Javier, Mar 29, 2022.

  1. Unity_Javier

    Unity_Javier

    Unity Technologies

    Joined:
    Mar 7, 2018
    Posts:
    155
    Hi,
    We’d like to share a debugging technique with you that will allow you to capture call stacks of the Editor when it is hung up and unresponsive. Attaching these call stacks to your bug reports can in some instances help us figure out where and why things are getting stuck, even if you can’t share your projects or other details with us.

    For some time we've been testing out an approach that will help show where the editor gets stuck and is compatible with old and new versions of Unity as well.

    What, you'll need:
    1. Process Explorer from SysInternals
    2. The right dbghelp.dll can be installed from here: Debugging Tools for Windows
    Then, open up Process Explorer, and in there find Unity.exe with the right parameters (i.e. the one that contains -projectpath [your_project_name])

    Inside Process Explorer click on Options -> Configure Symbols and point to the right dbghelp.dll from step 2.

    The Symbols Path should be the path to the Editor folder for the version of Unity you want to debug (i.e. C:\Program Files\Unity\Hub\Editor\[UNITY_VERSION]\Editor\ ). It's important to select the right version of the Editor because it will use the symbols supplied by the PDB files to figure out the name of the functions being executed. Unfortunately, it cannot resolve call stack frames that are using Mono in them.




    Once that is set up, double click Unity.exe in ProcessExplorer, go to the Threads tab, and double click the one that says Unity.exe!WinMainCRTStartup

    That will show the current call stack on the main thread in Unity (like in the picture below). Using this call stack can help us figure out what's going on with the Editor faster, and it might speed up our debugging investigations as well.



    Looking forward to helping out and resolving these issues of the editor getting stuck. Please feel free to use this thread to ask questions and discuss the debugging process. Please don’t use it to report your issues. Use the bug reporter for that.
     
  2. cdr9042

    cdr9042

    Joined:
    Apr 22, 2018
    Posts:
    149
    How do I get dbghelp.dll?
    I follow your link to the download page and download this: https://go.microsoft.com/fwlink/?linkid=2173743
    I open the installer and check the Debugging Tools for Windows
    upload_2022-5-9_16-49-43.png

    It downloads a bunch of msi files. I click on all of them but nothing happens. Where do I get the dbghelp.dll file?
    upload_2022-5-9_16-51-37.png

    The computer does not have Visual Studio installed
     
    Last edited: May 12, 2022
  3. Unity_Javier

    Unity_Javier

    Unity Technologies

    Joined:
    Mar 7, 2018
    Posts:
    155
    Hey, I'll update the post with more instructions shortly, but from the link you gave me, the winsdksetup.exe is the file that gets downloaded, and opening it up gives you the choice to install a few things.
    If you select the "Debugging Tools For Windows" (refer to pic below) it should then install it in the following location by default:
    C:\Program Files (x86)\Windows Kits\10

    upload_2022-5-11_20-40-14.png

    Then, if you can go to the bin\x64 folder you should find DbgHelp.dll and you can then point Process Explorer to use that: C:\Program Files (x86)\Windows Kits\10\bin\x64\DbgHelp.dll

    This looks almost like what you wrote up there, so please let me know if it doesn't work and I can look into it some more.
     
    cdr9042 likes this.
  4. chaoscreater

    chaoscreater

    Joined:
    May 9, 2022
    Posts:
    4
    What if the Unity isn't hanging or freezing, but crashing instead? I can see crash dumps for my Unity games located here:

    %localappdata%\CrashDumps

    Would these crash dumps include the Unity symbols? I would presume not, since the symbols are configured to be loaded in Process Explorer? If we need to analyze the crash dumps, how can we make sure that it includes the symbols?
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,160
    Symbols are located next to Unity.exe in Unity installation directory. You can also point the debugger to our symbol server (https://symbolserver.unity3d.com/). Dumps never include symbols.
     
    Unity_Javier likes this.