Search Unity

Unity Freeze when connecting VS Debugger

Discussion in 'Editor & General Support' started by Joe_86, May 4, 2018.

  1. Joe_86

    Joe_86

    Joined:
    Jan 12, 2015
    Posts:
    6
    Hey Guys.

    Since three days, i have a really annoying issue:
    When i connect the Visual Studio 2017 Debugger to my Unity Installation (Unity 4.x), the Editor freezes completely. There is no error message, timeout or anything else. If i disconnect the Debugger, Unity continue like nothing has happened. I have not to be in play mode to freeze the Editor with the debugger.

    This Bug is Project independent. I have the same problem with a completely new and empty Project. There is no difference if i use the Visual Studio for Unity Plugin or not.

    I use the latest Version of Windows 10 + Visual Studio 2017 Professional.

    I already tried to completely uninstall Visual Studio 2017, Unity and even the last Windows 10 Updates, but nothing seems to work.

    If i connect with MonoDevelop, everything works fine, but MonoDevelop is no alternative in my Company.

    Do you have any ideas or tips what else i can try to fix this?

    Thx!
     
  2. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    246
    Ran into the same issue today (though on 2017.3.1, win 10, vs 2017). For whatever reason, if I click the "play" button that says "Attach to Unity", Unity simply locks up until I detach. I am able to debug just fine though if I go to the "Debug" menu and choose "Attach Unity Debugger". Hope that helps someone.

    EDIT: Nevermind. The problem is now presenting itself even when attaching through the menu... It worked for about 20 minutes.

    Edit again: The problem ended up being conditional breakpoints. If I have a conditional breakpoint in the project, it locks up Unity (even though it isn't hitting). The breakpoint will hit one time, and after that, nothing works. Restarted Unity, Visual Studio, even a reboot didn't get the breakpoint to work again. Removing the breakpoint resolves the issue.
     
    Last edited: May 30, 2018
    huihut, sier_ua, Menion-Leah and 3 others like this.
  3. Joe_86

    Joe_86

    Joined:
    Jan 12, 2015
    Posts:
    6
    @gtzpower: Thx for the feedback. Unfortunately, i have still this issue without any breakpoints.
     
  4. Lardalot

    Lardalot

    Joined:
    Jun 19, 2013
    Posts:
    9

    Thanks!! I haven't been able to debug properly for for days, I just deleted all breakpoints and now it's all good again.
     
    gtzpower likes this.
  5. Xblade-Imperium42

    Xblade-Imperium42

    Joined:
    Jan 12, 2016
    Posts:
    597
    Still happens~
     
  6. KBVDev

    KBVDev

    Joined:
    Dec 1, 2017
    Posts:
    2
    Had the same issue just now. Deleting breakpoints fixed it for me, but this bug still needs to be adressed.
    Has someone found a bug report?
     
    Maeslezo and Hosnkobf like this.
  7. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    211
    I've just started hitting this as well, pretty big deal not being able to debug code efficiently.

    Debug works the first time in a session (clean boot), after that it just locks up every time.

    // WildStyle
     
  8. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    623
    I thought I was the only one having these issues, since we use a hot-reloading external DLL setup, I figured it must be all the crazy things we're doing the debugger just poops itself. It worked pretty alright with Unity 2017 3.1p1 and VS2015 (can't recall which VSTU version). But then as soon as we updated to latest VS2017 (15.8.4) and Unity 2018 2.6f1. The debugger freezes every single time I detach it, almost a 100% repro. I thought it must be Unity 2018, so we went back to Unity 2017 4.1f1, while it happens _slightly_ less, it still happens quite a lot, very frequent.

    Every new Unity comes in, you get all these new fancy features yet the core programming environment is not robust. We're considering all sorts of work-arounds atm, even developing our game in a separate exe, and abstracting out the rendering part, just so we could debug... Not cool, not cool.
     
    Menion-Leah and RakNet like this.
  9. Hullabu

    Hullabu

    Joined:
    Oct 23, 2014
    Posts:
    17
    Same freezes.
    Tested on:
    Unity v2018.2.7f1 and Unity v2018.2.8f1, VS2015 and VS2017
    Nothing helps. Impossible to work.
     
    unity_vK4Nnt93vsHKdg likes this.
  10. Froghuto

    Froghuto

    Joined:
    Oct 4, 2012
    Posts:
    45
    Had the same problem, deleting all breakpoints fixed it for me too
     
  11. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    59
    gee... this is fun!
    Mine was working just great until I updated visual studio. Now, it takes 5 minutes (during which both VS and the Unity Editor are frozen) to start. And, heavens help you if f-10 into something like Unity Analytics... It just hangs.

    Win10
    Unity 2018.2.8
    VS2017 15.8.28010.2026
     
  12. Cross22

    Cross22

    Joined:
    Sep 26, 2014
    Posts:
    20
    Using Visual Studio 2017 for Mac it doesn't freeze - instead it crashes the Unity process..
     
  13. KISP

    KISP

    Joined:
    Sep 13, 2018
    Posts:
    29
    Happens with Unity 2018.2.7f1 and VS 2017 15.8.4 on Win 10. Mine also only started after I updated VS. Originally after the update, it would only fail 1/3 times, but now it fails 100% of the time.
     
  14. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    211
    There has been an update to Visual Studio and the Unity tools bundled with it, evidently this fixes the issue, although I've not had time to confirm yet.
     
  15. KISP

    KISP

    Joined:
    Sep 13, 2018
    Posts:
    29
    I've updated to the newest patch, and everything seems to be working again.
     
  16. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    211
    Right - takes a while to attach for me, however does seem to work now which is a relief!

    // WildStyle
     
  17. unity_vK4Nnt93vsHKdg

    unity_vK4Nnt93vsHKdg

    Joined:
    Jun 3, 2018
    Posts:
    4
    I have the same issue with unity and vs2017. it keeps hanging and is frustrating that you cannot do debug.
     
  18. zero_null

    zero_null

    Joined:
    Mar 11, 2014
    Posts:
    157
    for me it's frozen without any breakpoint or attaching debugger. Just clicking Open C# Project from the Project window will open vs and it'll stay this way for hours. Tried system restore, updated VS 2017 community to the latest version and finally reinstalled Windows (Thinking there's a virus causing this- Was recently effected with Neshta C Virus) all in vain. The same thing is happening.
    Project isn't opening from Unity.
    Visual studio loads fine when open standalone.
    and if Unity Project is opened from the recent solution list, it hangs there as well.
     
  19. DerWoDaSo

    DerWoDaSo

    Joined:
    May 25, 2009
    Posts:
    124
    Clearing all breakpoints via menu (Debug > Delete All Breakpoints) solved the issue for me!
     
  20. mbrindic

    mbrindic

    Joined:
    Mar 13, 2014
    Posts:
    11
    Oh thanks man, you're a lifesaver!
     
    Xblade-Imperium42 likes this.
  21. northernthumb

    northernthumb

    Joined:
    Jan 2, 2013
    Posts:
    6
    After going down an FMOD blind alley, this worked for me too.
     
  22. Xblade-Imperium42

    Xblade-Imperium42

    Joined:
    Jan 12, 2016
    Posts:
    597
    This issue is at the top of Google and still happens, today, in Unity 2018.3
     
  23. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    525
    Yep, this is happening to me right now in 2018.3.6f1
     
  24. atti

    atti

    Joined:
    Feb 22, 2011
    Posts:
    77
    Same here.
    Deleting just the breakpoints didn't help.
    Also removed project and solution file ( these are generated by Unity in the root of the project and have the extensions *.csproj and *.sln) and restarted Unity/VSC
    That worked for me.
     
  25. Num0n1

    Num0n1

    Joined:
    Aug 19, 2016
    Posts:
    7
    deleting all the breakpoints worked for me ,thanks guys.
     
  26. rwgames68

    rwgames68

    Joined:
    Jul 2, 2012
    Posts:
    6
    Deleting all breakpoints worked for me as well, thanks.
     
  27. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    339
    Also, can be done via the "Breakpoints" window. In my case it showed a list of several hundred of obsolete breakpoints, even from files that actually no longer existed. That really surprised me. They accumulated there over several months.

    In this window, select the entire range of those breakpoints (by holding shift-key), and delete all of them.
     
  28. albertoha94

    albertoha94

    Joined:
    Apr 14, 2015
    Posts:
    1
    Just as a Note.
    This is still hapenning in Unity 2018.3.13f1.
    Man this is annoying.
     
  29. Julien_

    Julien_

    Joined:
    Nov 12, 2013
    Posts:
    41
    I have an issue that is similar or even the same. I'm on Windows 8.1, Unity 2018.3.10f1, Visual Studio 2017 (15.9.12), VSTU 3.9.0.3
    Unity runs fine when there are no breakpoints. As soon as I add a breakpoint that should be hit, Unity freezes (which is kinda expected behaviour when hitting a breakpoint), but in Visual Studio the breakpoint is not hit. Clicking anything in Visual Studio results in VS freezing too, until I force quit Unity via the Task Manager.

    A thing I noticed is, that VS correctly stops at breakpoints in the first frame of the application. The issue only appears when I click continue or add a breakpoint after the application is already running.

    Another weird thing is, that I'm not able to reproduce this in an empty project. Other people running the same project can use the debugger just fine.

    Edit: Another issue that seems related: Whenever I'm in play mode and make changes to a script, once I hit save, Unity freezes completely and I have to force quit.
     
    Last edited: May 31, 2019
  30. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    155
    Connecting to Unity can take up to a minute where there's long periods of freezing.
     
  31. Julien_

    Julien_

    Joined:
    Nov 12, 2013
    Posts:
    41
    Just as an update from my side in case anyone has the same issue:
    I solved this by adding Unity to the excluded processes in Windows Defender.