Unity Freeze when connecting VS Debugger

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!

4 Likes

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.

31 Likes

@gtzpower : Thx for the feedback. Unfortunately, i have still this issue without any breakpoints.

1 Like

Thanks!! I haven’t been able to debug properly for for days, I just deleted all breakpoints and now it’s all good again.

5 Likes

Still happens~

1 Like

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?

8 Likes

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

2 Likes

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.

5 Likes

Same freezes.
Tested on:
Unity v2018.2.7f1 and Unity v2018.2.8f1, VS2015 and VS2017
Nothing helps. Impossible to work.

2 Likes

Had the same problem, deleting all breakpoints fixed it for me too

4 Likes

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

Using Visual Studio 2017 for Mac it doesn’t freeze - instead it crashes the Unity process…

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.

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.

I’ve updated to the newest patch, and everything seems to be working again.

Right - takes a while to attach for me, however does seem to work now which is a relief!

// WildStyle

I have the same issue with unity and vs2017. it keeps hanging and is frustrating that you cannot do debug.

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.

Clearing all breakpoints via menu (Debug > Delete All Breakpoints) solved the issue for me!

17 Likes

Oh thanks man, you’re a lifesaver!

2 Likes