Search Unity

Unity Editor freeze when pass on breakpoint

Discussion in 'Scripting' started by titohazin, Jun 6, 2017.

  1. titohazin

    titohazin

    Joined:
    Aug 3, 2015
    Posts:
    5
    In Debug mode (Visual Studio 2017 or 2015), Unity Editor freezes when pass on breakpoint and don't stopping at it.

    The debug don't stopes on breakpoint and the editor don't crash, but freeze.
    In addition, this happens every time that debug pass to breakpoint, it never works.


    I work with Windos 8.1 (x64), Unity 5.6.1f1(x82), VSFU 3.1.0.0. My builds need to be on x86.
     
  2. deraggi

    deraggi

    Joined:
    Apr 29, 2016
    Posts:
    88
    I'm having the exact same issue on 5.6.f3.

    Were you able to solve it in the meantime? This is a nightmare
     
  3. titohazin

    titohazin

    Joined:
    Aug 3, 2015
    Posts:
    5
    I haven't been able to resolve this yet, but I suspect that in Windows 10 this doesn't happen.
     
  4. deraggi

    deraggi

    Joined:
    Apr 29, 2016
    Posts:
    88
    I have Windows 10 :(

    How do you work around this?
     
  5. titohazin

    titohazin

    Joined:
    Aug 3, 2015
    Posts:
    5
    I don't know... If you solve this, report plz.
     
  6. deraggi

    deraggi

    Joined:
    Apr 29, 2016
    Posts:
    88
    Have you tried if it there is a different in another project?
     
  7. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    The editor should freeze when you're at a break point. Are all of you saying that the debugger isn't showing anything in VS?
     
    LiterallyJeff likes this.
  8. deraggi

    deraggi

    Joined:
    Apr 29, 2016
    Posts:
    88
    What happens to me is:

    - I set a breakpoint, Attach Unity
    - I run the game in editor and reach the point where the breakpoint is.

    Now, one of 3 things happens since the 5.6 Upgrade:

    - Debugging starts normal, I can debug (maybe 1 / 15 times)
    - Debugging starts normal, but after going to the next line, VS freezes, the editor stays frozen. When killing the VS task, the editor stays frozen (maybe 1 / 15 times)
    - Debugging doesn't start, but VS freezes. When killing the VS task, the editor stays frozen (13 / 15 times)

    I tried with VS 2015 3.1.0.0 and VS 2017
     
  9. deraggi

    deraggi

    Joined:
    Apr 29, 2016
    Posts:
    88
    SORRY, made a mistake. In variant 3) VS does NOT freeze, but also doesn't start the debugger. When pressing STOP, nothing happens, the Unity Editor stays frozen
     
    hp5588 likes this.
  10. deraggi

    deraggi

    Joined:
    Apr 29, 2016
    Posts:
    88
    FYI: I upgraded to 5.6.2 and the issue is gone
     
  11. deraggi

    deraggi

    Joined:
    Apr 29, 2016
    Posts:
    88
    I have to CORRECT myself - the issue is NOT solved. It worked fine this morning however....
     
  12. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Same issue here :c
     
  13. deraggi

    deraggi

    Joined:
    Apr 29, 2016
    Posts:
    88
    Poor you. Haven't been able to resolve it yet. I've now switched to VS code, lets see if it works now
     
  14. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    Did you submit a bug-report to Unity Technologies, following the advice in this document? From my experience, it's very unlikely that UT is going to fix these kind of issues, if they do not have a bug-report in their system.

    Using the bug-reporter seems to be an important step, because it makes sure the report is in Unity Technologies bug-tracking pipeline and has to be processed at some point. Using the forum is often used to add to a little more attention to a bug-report, but does not replace actually submitting a bug-report.

    It's from advantage to attach a project to the bug-report that UT can use to reproduce the issue and test their fix against. The easier an issue can be reproduced by QA, the more likely it is to get forwarded to a developer, who might or might not work on a bug-fix for that at some point.

    After you submitted the bug-report, you receive a confirmation email with a Case number. UT often asks us to post the Case number in the forum thread, which allows them to find that bug-report if they look at your post.

    Following these steps will increase the chance that UT is looking at your issue tremendously.
     
  15. deraggi

    deraggi

    Joined:
    Apr 29, 2016
    Posts:
    88
    Hi Peter,

    seems like this is my only chance. My issue didnt get fixed with the change to VS Code unfortunately
     
  16. Dunk86

    Dunk86

    Joined:
    May 10, 2015
    Posts:
    53
    I had this problem today when running the editor in WebGL mode in Unity 2017.3 - the Unity editor in play mode would just freeze as the breakpoint hits, but visual studio never actually reaches the breakpoint, so I can't continue, just ctrl-alt-delete everything.
    I found out however, that my player settings->publishing settings had Debug Symbols turned on (from some previous build+run debugging), and turning that off resolved the issue!
    Worth a try if you're in WebGL mode.
     
  17. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
    We had this issue, editor freezing when debugging and thus unable to do the action to trigger a breakpoint.

    Our Workaround : Remove all breakpoints from VS breakpoints list.

    After that we were able to debug again.

    (Unity 2017.4.5.f1, UnityVS 3.8)
     
  18. alteredmatter

    alteredmatter

    Joined:
    Sep 14, 2016
    Posts:
    26
    We started having this issue some days ago. We noticed this happening when on Unity 2017.4.14f1 and this is still happening for us now in Unity 2017.4.15f1, but I'm not sure if this could be the reason.

    We see the same thing being described on the previous messages from @deraggi and @titohazin.
    It seems that Visual Studio can connect to the Unity Editor without problems, but if we add a breakpoint, once it should hit it the Unity Editor just freezes and Visual Studio doesn't show anything happening at all, no "breakpoint has been hit" reaction. We can stop the debugger and close Visual Studio, but Unity is frozen until ending the task from the Windows Task Manager.

    On uncertain cases, we can hit some breakpoints and everything reacts as expected (Unity freezes, Visual Studio reacts and shows the breakpoint being hit, we can step forward, etc.), but almost always it now just causes Unity to freeze without anything else happening at all.

    Deleting all breakpoints doesn't seem to solve this. We've tried deleting all Visual Studio project/solution files, Unity's Library, building everything again, etc. but nothing changes.

    This is happening both on Visual Studio Community 2017 and Visual Studio Code, and on different computers as well. It's become impossible to debug our code now.

    Did any of you find a solution to this?
     
  19. alteredmatter

    alteredmatter

    Joined:
    Sep 14, 2016
    Posts:
    26
    So after many hours I think I've found the issue in our case.
    After realising that this issue only happened on scenes where we had music going on, I checked on FMOD (the audio engine we're using) and this seemed to be the cause. Found an answered question here: https://www.fmod.org/questions/question/visual-studio-freezes-when-debugging-with-fmod-installed/

    With this useful information in it:

    https://docs.microsoft.com/en-us/vi...es-visual-studio-tools-for-unity?view=vs-2017

    I ended up modifying the "studioInitFlags" inside Initialize() on RuntimeManager.cs from the FMOD Integration like this:
    Code (CSharp):
    1. #if UNITY_EDITOR
    2.     studioInitFlags |= FMOD.Studio.INITFLAGS.SYNCHRONOUS_UPDATE;
    3. #endif
    and this seems to have cleared the issue, at least for now.

    Hope this is useful if anyone hits a similar problem.
     
    slice3d and tactileunity05 like this.
  20. tactileunity05

    tactileunity05

    Joined:
    Oct 11, 2018
    Posts:
    1
    @alteredmatter , i am having similar issues, however, i am the one to spawn these processes. The reason for doing so is that i am making processes that executes SVN commands. In my case that also caused Unity to freeze when recompiling, because Unity was waiting for processes to finish, which now was stuck. I managed to solve this issue by killing all processes when compilation started.
    However, I see no way to kill my processes when a break point is about to trigger... Like, there seems to be no callback available for when a break point is about to be triggered. This results, as noted in earlier messages, with Unity freezing, and Visual Studio (or Rider in my case) not doing anything. If i open the task manager, i can see a couple of additional processes under Unity. If i forcefully kill the ones belonging to my code (but not unity itself), then Unity will resume (as it is now done waiting for the process), and the breakpoint will trigger in Rider.
    But it is of course not feasable to enter the task manager and kill a process every time i want a break point triggered...

    So, do you, or anyone else have any idea on how this? Do i need to launch processes in a certain way? Is there some settings in unity to make it not wait for processes when it does these kinds of actions? I am quickly running out of ideas about how to deal with the situation...
     
  21. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    This worked for me:

    in visual studio, open a window called "Breakpoints". In my case it showed a list of several hundred of obsolete breakpoints, even from files that actually no longer existed. 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.
     
    Peter77 likes this.
  22. DeveloperSky

    DeveloperSky

    Joined:
    Feb 27, 2018
    Posts:
    1
    update visual studio 2017. it solves it.