Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

MonoDevelop debugging always hangs when attempting to attach to Unity

Discussion in 'Editor & General Support' started by Tiktaalik, Dec 6, 2013.

  1. Tiktaalik

    Tiktaalik

    Joined:
    Apr 9, 2013
    Posts:
    5
    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:
    1. Launch Unity
    2. Launch Monodevelop
    3. In Monodevelop Run->Attach To Process
    4. 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.
     
  2. Thormor

    Thormor

    Joined:
    Nov 22, 2012
    Posts:
    39
    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.
     
  3. jchow

    jchow

    Joined:
    Jun 20, 2013
    Posts:
    28
    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)
     
  4. Lohoris2

    Lohoris2

    Joined:
    Aug 20, 2013
    Posts:
    86
    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.
     
  5. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    +1 still having this problem. currently using Unity 4.3.2 on Mavericks
     
  6. zbyhoo

    zbyhoo

    Joined:
    Nov 18, 2013
    Posts:
    17
    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
     
  7. Tiktaalik

    Tiktaalik

    Joined:
    Apr 9, 2013
    Posts:
    5
    Tried this but it didn't work for me. :(

    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.
     
  8. rsb_jeremy

    rsb_jeremy

    Joined:
    Jan 8, 2014
    Posts:
    5
    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.
     
    questmill likes this.
  9. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    Last edited: Jan 16, 2014
  10. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    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.
     
  11. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    Does anybody know if it is possible to use an earlier MonoDevelop 2 version with Unity 4.3+?
     
  12. jchow

    jchow

    Joined:
    Jun 20, 2013
    Posts:
    28
  13. Adita

    Adita

    Joined:
    Jan 28, 2014
    Posts:
    1
    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.
     
  14. yamoinca2

    yamoinca2

    Joined:
    Feb 7, 2014
    Posts:
    1
    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!
     
  15. cesarpo

    cesarpo

    Joined:
    Jun 8, 2013
    Posts:
    98
    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.
     
  16. Mabenan

    Mabenan

    Joined:
    Feb 7, 2014
    Posts:
    132
    I always start monodevelop and go than in in run->run-with->unity debugger
     
  17. comocc

    comocc

    Joined:
    May 10, 2014
    Posts:
    2
    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
     
  18. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    Please fix the debugger. It has been broken for months. This is really unacceptable for professional software.
     
    NobleAnarchist and fum1h1ro like this.
  19. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    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.
     
  20. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    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.
     
  21. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    When will the debugger be fixed?
     
  22. cesarpo

    cesarpo

    Joined:
    Jun 8, 2013
    Posts:
    98
    If things keep going like this, wait for Unity 84.2 :p
     
  23. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    Are you going to fix the debugger before 4.6?
     
  24. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    Hallelujah, kiss the baby jebus. I think the debugger is fixed in 4.5.1. My preliminary testing shows it working again. Can anyone else confirm this?
     
  25. Griautis

    Griautis

    AI & Physics STE Unity Technologies

    Joined:
    Jan 26, 2013
    Posts:
    63
    Hey,

    Can anyone else confirm that it's working ? If not, please send a bug report and post the case number here.

    Best wishes,
    Ugnius
    Unity QA Team
     
  26. cesarpo

    cesarpo

    Joined:
    Jun 8, 2013
    Posts:
    98

    Seems to be working :eek:


    Still, there is an error when trying to see the contents of a generic list (I remember this one from the MD 2.8 times):


    Unknown type 'System.Collections.Generic.CollectionDebuggerView`1, mscorlib.dll'


    Which is kind of hilarious when you think about it :rolleyes:, but having a working debugger again is awesome, Thanks!
     
  27. gmxtian

    gmxtian

    Joined:
    Jul 10, 2012
    Posts:
    8
    This is still a problem for me. At first, things seemed to be working wonderfully, but over time I'm back to locking up frequently trying to debug code. OS X 10.9.4, Unity 4.5.4f. I reported the bug from Unity and did not receive a case number. :-/

    I've had this problem for well over a year, on an older Macbook and a newer one.
     
  28. Domino-Studios

    Domino-Studios

    Joined:
    Oct 26, 2012
    Posts:
    31
    I have the same probleme under Unity 4.5.4f1

    On iMac mid 2011 OSX10.9.4
     
  29. gooncorp

    gooncorp

    Joined:
    Dec 30, 2011
    Posts:
    133
    still an issue in 4.5.4.

    this issue is still not fixed. this is a bug and it is a current problem as of RIGHT NOW. YOU CANNOT DEBUG in MONODEVELOP. WHY IS THIS NOT BEING ADDRESSED? If you have to do some workaround that means it is STILL BROKEN!
     
    Last edited: Oct 4, 2014
  30. Griautis

    Griautis

    AI & Physics STE Unity Technologies

    Joined:
    Jan 26, 2013
    Posts:
    63
    Hello there,

    Could you please send us a bug report and post the case number here? (or in a PM to me)
     
  31. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    970
    Hi Griautis, I will file a bug report as I cannot get Monodevelop 4.0.1 to attach to Unity 4.5.5 without hanging.

    Edit: opened 642699

    I would be pleased to work on this with you!
     
    Last edited: Oct 25, 2014
  32. femtobyte

    femtobyte

    Joined:
    May 24, 2013
    Posts:
    1
    I was having this problem with Unity 4.6b20, and what seemed to make the difference for me was editing the Preferred Debuggers in MonoDevelop's Preferences: Preferences>Debugger>Preferred Debuggers tab, and move Unity Debugger to the top. I also flipped thru the other preferences and got rid of a couple key binding conflicts, and made sure the Unity Debugger setting (in MonoDevelop preferences) was set to launch Unity automatically, and not set to Build project in MonoDevelop.

    After I changed these preferences, it started working fine.
     
  33. bererton

    bererton

    Joined:
    Jun 20, 2014
    Posts:
    34
    @femtobyte you are my hero as I was getting all sorts of random crashes as well. I also found that turning on a firewall on OSX will cause Unity 4.6b20 to crash as well, even though I tried letting mono, unity etc. through the firewall. Hopefully that will help someone else as well.
     
  34. andsee

    andsee

    Joined:
    Mar 20, 2012
    Posts:
    88
    @femtobyte That's seems like a fix. I thought unity had fixed it in 4.6f3 but today it started happening again, mono hang when trying to select process in attach window. Changing the priority now means that I don't have to try to select a row and clicking attach actually works. Keeping my fingers crossed that it stays that way!
     
  35. fum1h1ro

    fum1h1ro

    Joined:
    Apr 22, 2014
    Posts:
    6
  36. ike_ellis

    ike_ellis

    Joined:
    Dec 5, 2014
    Posts:
    2

    I also still have this problem. Under 4.5.4 and 4.6, the Attach dialog locks up Monodevelop and I have to Force Quit. Changing the debugger priority had no effect for me. Under 4.3 I had this problem, but only at about 50% frequency. Now it's 100%.
     
  37. ike_ellis

    ike_ellis

    Joined:
    Dec 5, 2014
    Posts:
    2
    Update... the solution of double-clicking the process to debug really fast before the dialog locks up DOES work. Frustrating, but gets me going for the moment.
     
  38. raeldor

    raeldor

    Joined:
    Jul 8, 2013
    Posts:
    52
    A chocolate bar for this man! Thank you!
     
  39. fastgamedev

    fastgamedev

    Joined:
    Mar 27, 2014
    Posts:
    91
    Didn't help. Same problem, MonoDevelop freezes on Attach Process, 100% repeat rate with any project.

    http://fogbugz.unity3d.com/default.asp?654616_qmuek57mn761m7eb
     
  40. cesarpo

    cesarpo

    Joined:
    Jun 8, 2013
    Posts:
    98
    IT'S BROKEN AGAIN!

    It only works if I double click *IMMEDIATELY* on the Unity Debugger list item. Using the Attach button hangs MonoDevelop, and taking too much time to double click also hangs it. It's like a click duel between me and the software.

    I didn't had this problem in 4.5.4 in Mavericks, but now I'm having this with 4.6 on Yosemite.
     
  41. tomeee

    tomeee

    Joined:
    Sep 20, 2014
    Posts:
    1
    +1, broken. Using OSX10.9.5, unity 4.5.5f1
     
  42. paulaceccon

    paulaceccon

    Joined:
    Sep 2, 2012
    Posts:
    1
    The solution that @rsb_jeremy said presented also worked to me. Wondering if there will be an official solution though.
     
  43. Dmitry-Volevodz

    Dmitry-Volevodz

    Joined:
    Apr 6, 2014
    Posts:
    10
    This still doesn't work. When will this be fixed?
     
  44. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    970
    I finally gave up and moved back to the dark side - windows and VS as my main dev platform.
     
    andsee likes this.
  45. andsee

    andsee

    Joined:
    Mar 20, 2012
    Posts:
    88
    Yep same here, Parallels + windows & VS. The bug still frustrates though when doing iOS builds, can't connect to the device on the mac. I suspect the bug must be something to do with the state of the machine and some incompatibility rather than the unity install it's self otherwise surely it would have been fixed by now, it's been around for over a year.
     
  46. vitor.navarro

    vitor.navarro

    Joined:
    Jul 18, 2013
    Posts:
    1
    I know this isn't quite a solution but what I did was:
    1. Start mono develop (You can open it through Unity but close Unity afterwards)
    2. In Mono Develop go to Run->Start Debugging
    3. Voilá, Unity and Mono are now connected and debug is working ;)

    Hope this helps.
     
  47. Andrey-Postelzhuk

    Andrey-Postelzhuk

    Joined:
    Nov 26, 2013
    Posts:
    73
    No :)
    I've got this problem when I started working with iOS platform. I tried to connect to device but then I realized I can't attach to editor too.
     
  48. andsee

    andsee

    Joined:
    Mar 20, 2012
    Posts:
    88
    @femtobyte's solution above helps some of the time when you want to debug the editor but I've not been able to debug iOS devices builds for over a year. It started to occur for me straight after upgrading to Mavericks and has not worked properly since across many versions of Unity.
     
  49. yozzozo

    yozzozo

    Joined:
    Oct 7, 2013
    Posts:
    5
    There is a 3 second delay for the MonoDevelop "Attach to Process" dialog to refresh its UI.

    Take a look here, line 68:
    https://github.com/mono/monodevelop...MonoDevelop.Debugger/AttachToProcessDialog.cs

    This is why the "click really fast" solution works -- you're closing the dialog within 3000ms before the Refresh method is run, which apparently crashes MonoDevelop.

    Hopefully someone in Unity will fix this soon, or allow us to migrate to Xamarin Studio, which is a much newer, improved version of MonoDevelop (I use it for app development). I also experience this issue with Unity 4.6.2 and MonoDevelop on the Mac (Yosemite), and my workaround has been to position my cursor where I imagine the "Attach" button will appear in the dialog when it pops up, and click the button within 3 seconds, assuming that the Unity debugger is the default selected item in the list. The bug has been affecting myself and countless others for years now, and it's really intolerable at this point. Does anyone at Unity use a Mac? Are the standard debug workflows tested at all?

    Unity devs, a good temporary workaround will be to set that timeout value to 300000 or something. That will at least allow the dialog to open and give people time to select stuff without worrying about it crashing.
     
  50. Andrey-Postelzhuk

    Andrey-Postelzhuk

    Joined:
    Nov 26, 2013
    Posts:
    73
unityunity