MonoDevelop debugging always hangs when attempting to attach to Unity

I’m having this issue where when I attempt to debug some code using Monodevelop I consistently get a hang when attempting to attach to the unity process. I have gotten it to work once or twice, but in general it pretty much never works.

Coworkers have no issues debugging the same project on both PC and Mac, so I don’t think it’s an issue with my project.

Repro steps:

  • Launch Unity
  • Launch Monodevelop
  • In Monodevelop Run->Attach To Process
  • Clicking attach to process will cause the hang. Sometimes though clicking anything causes a spinning beach ball hang, and sometimes just doing nothing and clicking the window will cause a hang.

My setup:

  • Macbook Air running Mavericks (10.9)
  • Non-pro Unity 4.3.0f4 (though I had the same issue running 4.2 and 4.3 beta)
  • MonoDevelop 4.0.1

Things that may be unique about my setup:

  • I occasionally write code in Sublime Text 2, making use of the CompleteSharp plugin which I believe runs a mono process. The issue occurs whether I have Sublime Text open or not.
  • My project lives on an external HD. The only time I have ever gotten debugging to work was when I moved my project to my computer’s local drive, and so I thought that fixed the issue, but since then I’ve still been getting the same issue whether the project is on local storage or external.

Any updates from Unity on this?

I had to update my Unity 4.2 since debugging under Maverick was impossible and now this? This is starting to be a real problem for my team and I.

This is also still happening to my team and me. This is ridiculous for software that we’ve paid thousands of dollars for.
(Unity 4.3.0f4, OS X 10.8.5)

I’ve got some hangs too, however it also worked some other times.
When I get a hang, then trying again will always hang again, so restarting both Unity and MonoDevelop is necessary: usually it works after doing that.
(I guess it’s not your case, I assume you already tried to restart both)

Also I have the feeling (not tested it properly) that it tends to hang more likely if I attach when Unity isn’t playing.

+1 still having this problem. currently using Unity 4.3.2 on Mavericks

I had similar problems when I was using external Monodevelop build, not the one that comes with Unity.

What I had to do to be able to debug without crashes/hangs (the order is important):

  1. start Unity and Monodevelop
  2. start/play the game in Unity editor
  3. attach Monodevelop to Unity editor process
  4. debug…
  5. deatach from Unity process
  6. stop the game in the Unity editor

Tried this but it didn’t work for me. :frowning:

I noticed with 4.3.2 there’s this interesting line in the change list which got me excited: “Debugger: Avoid deadlocks on OSX.”

I downloaded and tried out 4.3.2 before Christmas and it seemed fixed. I was able to set a breakpoint and stop on one!

Unfortunately I just tried to set a break point for the second time ever and… it doesn’t work. The same issue persists. Did I somehow get lucky the first time? Maybe some other thing I did when I reinstalled Unity? I have no idea, but the problem unfortunately persists for me.

I’m having the same problem on 4.3.2f1 on Mavericks. The key for me is if I double-click the Unity application from the list that appears IMMEDIATELY when hitting ‘attach to process’, it will connect and work properly. It seems that once I wait a few seconds and then try to click, the dialogue becomes unresponsive and my only recourse is to kill the app and restart it. While it is in the broken state, the cursor will alternate between the ‘waiting’ cursor and the standard cursor, but nothing ever becomes clickable.

I think that this is different from the previous issue where the Unity Editor needed to be actively running a script when you try to connect. Everyone here is already on Mavericks, so I don’t have an easy way to see if it is a Mavericks-only issue.

Hopefully my ‘click immediately’ workaround above helps someone else until the issue is properly resolved.

1 Like

tried the solution in http://forum.unity3d.com/threads/222979-Upgraded-to-4-3-3-now-debugging-is-broken and it did not work. Still getting the hang. I can’t imagine the speed of attaching to the Unity debugger would matter but I will give it a try.

Upgrading Unity 4.3.3 doesn’t fix the problem. Starting the app first and then trying to attach the debugger is a non-starter as that makes it impossible to really testing Awake() timed events.

Does anybody know if it is possible to use an earlier MonoDevelop 2 version with Unity 4.3+?

Everyone view this bug and vote for it!

I have absolutely the same problem with Unity 4.3.3f1 on OSX 10.9.1. Also my iOS devices never show up on the process list.

Thanks jeremy, your workaround worked for me, it now allows me to at least debug the App running in the Unity Editor.

Any ideas how to solve this, apart from waiting for a solution from the Unity team? It seems this bug has been around a while…
Maybe there is another debugger that works more consistently?

I’m a new user to Unity, so far i have been impressed, but now struggling with the debugger is spoiling my enthusiasm.

This absolutely helped. I always thought giving Monodevelop time was the nicer approach, but if I select the Unity Editor process and press Attach Monodevelop invariably ramps up CPU use and rainbows and I have to force quit.

With this double click method I haven’t had it do this yet!

I’m on Mavericks, having the same problem as previous posters, just posting here to bump this thread and see if there is an official response from the unity team. The debugger is pretty unusable for me.

At least I would like to know if this is a “know issue /won’t fix” problem, or if there is still hope.

I always start monodevelop and go than in in run->run-with->unity debugger

I tried this. It was apparently successful.
But when I set a break point (e.g. OnUpdate()) while playing, Unity and MonoDevelop will hang.

Unity 4.3.4f1
OSX 10.9.2 on MacBook Air 11-inch, Late 2010

Please fix the debugger. It has been broken for months. This is really unacceptable for professional software.

2 Likes

Still not fixed in 4.5. Unity, your debugger is broken. It has been broken a very long time. Please fix this. It is very difficult to work in a professional, modern day development environment and not have a functioning debugger. It is bush league and slow-as-hell to have to use log statements.

This is the email response I got when I submitted this bug back in February.

( Case 588758 ) Breakpoints set in MonoDevelop do not work in Unity 4.3.0

You have the fix already. This fix should have been in 4.5. Please include it in quick point patch.