Search Unity

Bug Unity freezes when opening script in Visual Studio - Editor Version 2021.3.3f1 and 2019.4.31f1

Discussion in 'Editor & General Support' started by TehMayhem, Oct 12, 2022.

  1. TehMayhem

    TehMayhem

    Joined:
    Feb 27, 2020
    Posts:
    11
    Hello hoping to get some other solutions for this issue. Anytime I try to open a script in Visual Studio by clicking on the script in the Unity project browser, Unity hangs and freezes, and the Hold On window displays the same message:
    "ProjectBrowser.MouseDown
    Waiting for Unity's code in UnityEditor.CoreModule.dll to finish executing."



    I have waited up to 2 hours in one case, and it still displayed the "Hold On" window. I have noticed this issue happens in any editor version above 2019.4.19f1 (Currently, I am using both 2021.3.3f1 and 2019.4.31f1). The only way for me to continue is to open task manager and force quit Unity. I can open the script in JetBrains Rider Editor and via "Open by file extension" mode and then have to manually search for my project's .sln file each time to reactivate the IntelliSense.

    I have tried many methods so far:
    - Complete uninstall of Unity Hub, all editor versions, and Visual Studio. I am following up with deleting all leftover files from the three programs. Shut down the computer for about 15 minutes and then re-installing it.
    - Tried going through my packages and going one by one in removing and seeing if I can open the script (Used to work when I deleted "Visual Studio Editor"; however that solution no longer works)
    - Tried updating packages
    - Tried removing PlasticSCM from the project (Note. I don't use Plastic, I use GitHub Desktop)
    - Tried logging into PasticSCM
    - Tried each mode "Script Changes While Playing" in preferences
    - Tried "Debug" in Code Optimization on Startup" in preferences
    - Tried deleting my Library folder in projects

    I am at a point where I am smashing my desk, trying to find an answer to this problem. So if anyone knows of any other suggestions or fixes that have worked for them, I would significantly appreciate it if you could share.

    Edit 1. If screenshots or any logs are needed let me know and I can get them.
     
    Last edited: Oct 12, 2022
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    When Unity gets into this state, can you right click on Unity.exe in Task Manager and press "Create Dump File"? If you could send me that file (after zipping it up and uploading to some cloud storage like google drive or dropbox), I might be able to tell what it is stuck on.
     
  3. TehMayhem

    TehMayhem

    Joined:
    Feb 27, 2020
    Posts:
    11
    Sent you the dump file link through conversations. Also this is what is appearing under Unity when in task manager: upload_2022-10-12_8-46-17.png
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Thanks. It seems it gets stuck while trying to open Visual Studio. Can you give me a few more details?

    1. What Visual Studio package version is your project using (you can see this in the package manager)?
    2. What exact version of Visual Studio are you using (you can see this Help -> About in Visual Studio)?
     
  5. TehMayhem

    TehMayhem

    Joined:
    Feb 27, 2020
    Posts:
    11
    1. Visual Studio Code Editor 1.2.5 and Visual Studio Editor 2.0.16
    2. Microsoft Visual Studio Community 2019 Version 16.11.20, also I have the Visual Studio Tools for Unity V4.11.4.0
     
  6. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    yesterday all was good.. Today, none of the projects previously worked, work now. Something has happened since yesterday.. :( and i did not update neither unity or vs-studio.
    edit. also not using plastic or online storage as suggested in the other thread.

    in 2021 LTS it was this,
    upload_2022-10-12_23-2-23.png

    threw same project into 2022 for a run..
    upload_2022-10-12_23-2-38.png

    Went from mouse down to mouse up, no timeout on both versions. no work on the computer, it's running at idle.. So it can ONLY be unity that is stuck.
     
    Last edited: Oct 12, 2022
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Hi, I heard back from Visual Studio package devs and they told me to ask you whether there are any lingering Visual Studio processes (devenv.exe) in the task manager. This kind of situation can happen if there's a modal dialog open in any of other open Visual Studio instances, and it is a limitation of Visual Studio (Unity waits for Visual Studio to respond, and it doesn't until the modal dialog goes away, hence the freeze).

    Another option would be trying to update to Visual Studio 2022, since they consider 2019 to be legacy at this point.
     
  8. TehMayhem

    TehMayhem

    Joined:
    Feb 27, 2020
    Posts:
    11
    No didn't see anything like that in task manager. Also, tried the 2022 install once and had the same issue.
     
  9. TehMayhem

    TehMayhem

    Joined:
    Feb 27, 2020
    Posts:
    11
    Also forgot to mention this earlier when it freezes, and I close it in task manager when Unity is closed out, sometimes Visual Studio will start up.
     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you install Visual Studio 2022 again, get Unity into this stuck state, and see if you can find "devenv.exe" in the task manager? If it's there, can you right click on it and press "Create Dump File" and send that to me?

    Just make sure that no instances of Visual Studio are open prior to double clicking on a script in Unity - that way it will be easier to read the dump for me.
     
  11. TehMayhem

    TehMayhem

    Joined:
    Feb 27, 2020
    Posts:
    11
    Hello, sorry for the long delay I have been traveling the past week. But when I click on a script there is no devenv.exe showing in the task manager. Sometimes it does launch Visual Studio, but after I end the unity editor in the task manager. upload_2022-10-27_12-22-27.png upload_2022-10-27_12-22-9.png
     

    Attached Files:

  12. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you check if it's the same in the "Details" tab? You should be able to sort it by name and look for "devenv.exe" there.
     
  13. TehMayhem

    TehMayhem

    Joined:
    Feb 27, 2020
    Posts:
    11
    Nothing there either.
    upload_2022-10-27_14-23-54.png
     
  14. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Thanks, I'll go back to Microsoft with this information.
     
  15. TehMayhem

    TehMayhem

    Joined:
    Feb 27, 2020
    Posts:
    11
    Any update?
     
  16. TehMayhem

    TehMayhem

    Joined:
    Feb 27, 2020
    Posts:
    11
    Has there been any update from Microsoft on what might be causing this issue and how to fix?
     
  17. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    I'm still waiting to hear back :(. I pinged them again.
     
  18. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Are there any "COMIntegration.exe" processes in the task manager when this happens? If there are, how many? If there's one, can you right click on it, press "Create Dump File" and send that over?
     
  19. TehMayhem

    TehMayhem

    Joined:
    Feb 27, 2020
    Posts:
    11
    Sorry for the later reply; notification didn't go through that you had an update. Yes, COMIntegration.exe is in the task manager. Will send you the dump file now.

    upload_2022-11-19_13-9-15.png
     
  20. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    I shared the dump with Microsoft, I'll let you know what they say.
     
  21. wellzito

    wellzito

    Joined:
    Mar 29, 2017
    Posts:
    6


    I had this same error message when trying to use the Text To TMP asset, had to go back to backup and look how slow it is to open the project.
     

    Attached Files:

  22. TehMayhem

    TehMayhem

    Joined:
    Feb 27, 2020
    Posts:
    11
    Any update from Microsoft?
     
  23. SefsCode

    SefsCode

    Joined:
    May 29, 2020
    Posts:
    2
    I also have this problem every second
     
  24. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    Hello,

    - We finally fixed the specific issue found by @TehMayhem.
    - We fixed rare deadlocks while discovering or launching Visual Studio on Windows as well.
    - We improved launching Visual Studio on macOs.

    We'll ship all those fixes with the upcoming 2.0.17 version of he VS Editor Package.

    Thank you.
     
  25. Yan1234567

    Yan1234567

    Joined:
    Dec 6, 2023
    Posts:
    2
    Workaround (worked for me):
    - Close Unity and Visual Studio
    - Under the main project directory, delete the {projectname}.csproj, {projectname}.Editor.csproj, and the {projectname}.sln files. They will be generated on the next run.
    - Reopen Unity