Search Unity

4.3.x MonoDevelop Breakpoints not working

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

  1. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    972
    That's great news, I spent some time trying to make a repro project but I just could not, even though our main project does it all the time on every machine.

    And yeah, it's definitely unrelated to adb.exe, most of the machines here do not have the Android SDK installed and it still happens there.
     
    Last edited: May 21, 2014
  2. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    Could I possibly take you up on that offer?

    Currently my source control method consists of copying the entire project folder to a backup drive and an online storage folder for every release version and prior to making any major changes.:)
     
  3. Dave-Hampson

    Dave-Hampson

    Unity Technologies

    Joined:
    Jan 2, 2014
    Posts:
    150

    Sorry - yes! I've just read this ... I will have to write something up.
    It's on my todo list now!

    Back on the original topic, I found this bug on the issuetracker. It seems to describe the exact issue people have been having... and yet it has zero votes: http://issuetracker.unity3d.com/issues/moving-file-failed-dialog-displayed-when-debugging

    The only thing I can think of is maybe there are several of these bugs in the issue tracker and for some reason they haven't been duped together under one heading that everyone can vote on. So, vote and if you find dupes out there, please post them! I will give QA a prod to combine them together...
    *edit* just realised even this bug doesn't describe the core problem that afterwards breakpoints stop working. Is there another?
     
  4. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    972
  5. Dave-Hampson

    Dave-Hampson

    Unity Technologies

    Joined:
    Jan 2, 2014
    Posts:
    150
    Here's a lazy shortcut to me writing out the steps: somebody already made a good video of how to set up bitbucket (although it doesn't include how to set up TortoiseHg):



    Switch Unity to metafiles if it isn't already and for you can tell Mercurial to ignore some files like the entire Library directory.
    And that's basically it!

    BIG FAT DISCLAIMER: Mercurial is what I use for most things now: now note that as primarily a coder I am probably not running into some of the size limitations that a Unity project with large assets might have, so you should probably keep an eye on the size of the .hg directory. Would be good to hear some different points of view on this. Some people might favour the largefiles extension to Mercurial, or Perforce, or Git + the annex extension (which I haven't tried).

    The key thing to remember is that yes you are going to use up more disk space because the .hg folder is going to store every previous version of your assets, but you have peace of mind that you can always go back. Disk space is (relatively) cheap, developer sanity isn't!

    Let me know if any of this isn't detailed enough and I (...or probably more likely someone else will beat me to it) will fill in the details!

    The first few minutes of this shows you how to create a 'normal' Mercurial repo:


    And this shows you how to commit (remember to push also, if you are pushing to a remote repository):
     
    Last edited: Jun 6, 2014
  6. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    Many thanks for the video links, I haven't watched them yet, but I'll post here again once I have with an update on how I got on.
     
  7. Seerix

    Seerix

    Joined:
    May 30, 2014
    Posts:
    1
    I have found a workaround and possible explanation to this issue.
    So far I have been able to fix the issue by detaching the debugger, editing the file, saving, focusing Unity and then reattaching the debugger. Just adding a space somewhere is enough.

    Just speculating here, but I thought it might help the devs.
    Since Unity recompiles the scripts into some internal structure, MonoDevelop works on an old copy of the debug data and gets confused. I remember .pdb files from my .NET days, but I can't seem to find them. This issue gets resolved by changing a file, saving and focusing Unity.
     
  8. meakeel

    meakeel

    Joined:
    Apr 22, 2014
    Posts:
    4
    Hi Seerix I agree, To me this looks like the sort of problem I get when I use multiple projects in ASP.NET to build up DLL's for the "master" project.

    The Mono Develop copy isn't matching the Unity compiled version which is what is stopping the breakpoints.

    I've been able to sort it a couple of times but it's a pain to have to spend 30-60 minutes trying to get them to re-sync.
     
  9. meakeel

    meakeel

    Joined:
    Apr 22, 2014
    Posts:
    4
    I have spent some time trying to work out the issue and have tried the following to get the breakpoints to work.

    1. Removed C:\Users\paul\AppData\Local\MonoDevelop-Unity-4.0\Cache
    1. Removed C:\Users\paul\AppData\Temp
    2. Removed Project Assembly files in the root (ie Assembly-CSharp.csproj)
    3. Removed \Library\ScriptAssemblies
    4. Removed \Library\AssetServerCacheV3
    5. Removed \Temp\
    6. Mono Clean project, Rebuild ect...
    7. Re-imported all assets via Unity
    8. Reverted my working copy to last checked in working commit
    9. Tested Working commit is works on my other machine (which it is)
    10. Tried the add a space and save.

    The problem doesn't effect all script files only script files that were modified while mono is attached to the debugger, I can see that unity is detecting the file changes and showing the new GUI in the logs

    Hashing assets ... 0.000914 seconds
    Updating Assets/ScriptsToMove/AIManager.cs - GUID: 17b0d11e843c60240a56d97f40872f8b...
    - starting compile Library/ScriptAssemblies/Assembly-CSharp.dll, for buildtarget 6
    done. [Time: 384.495497 ms]

    However it just doesn't seem to be matching up with Mono and stopping me from being able to debug, can anyone think of any other files that might be be causing it?
     
  10. hkdtmer

    hkdtmer

    Joined:
    Apr 2, 2014
    Posts:
    35
    Same problem in 4.5.3f3
    It is really frustrating.
     
  11. Dave-Hampson

    Dave-Hampson

    Unity Technologies

    Joined:
    Jan 2, 2014
    Posts:
    150
    When this occurs, do people find that closing MonoDevelop and Unity and deleting ScriptAssemblies or UnityAssemblies helps? Or does it require a reboot?
     
  12. Dave-Hampson

    Dave-Hampson

    Unity Technologies

    Joined:
    Jan 2, 2014
    Posts:
    150
    Also, do people find that this works?
    • Disconnect debugger
    • Right-click a script (in Unity)
    • Pick Reimport
     
  13. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    972
    Deleting ScriptAssemblies always works here, on all machines, never had to reboot for it. Reimport works sometimes, I'm sure I've had it not work before.
     
    coolaneasy likes this.
  14. hkdtmer

    hkdtmer

    Joined:
    Apr 2, 2014
    Posts:
    35
    If I delete these files, breakpoints sometimes work again
    ScriptAssemblies
    \AppData\Local\MonoDevelop-Unity-4.0
    Reimport doesn't work.
    Occurs in both win7 and win8.1

    But after a few minutes of editing in MonoDevelop the breakpoints will stop working again (empty pink circles instead of solid dots).

    Is is possible to use other editors with Unity with debugging? The bundled MonoDevelop is totally unusable if this problem persists.
     
  15. Dave-Hampson

    Dave-Hampson

    Unity Technologies

    Joined:
    Jan 2, 2014
    Posts:
    150
  16. hkdtmer

    hkdtmer

    Joined:
    Apr 2, 2014
    Posts:
    35
    Thanks and downloading:)
     
  17. coolaneasy

    coolaneasy

    Joined:
    Apr 10, 2013
    Posts:
    1
    I just had this problem so I started looking up solutions which brought me to this thread. Deleting scriptAssemblies or UnityAssemblies did it for me. No deleting whole library folder, reimport all or reboot or messing with cache was required in my case.
     
  18. vinnyhassell

    vinnyhassell

    Joined:
    Aug 28, 2014
    Posts:
    1
    Deleting the library folder in my Unity project directory and restarting Unity and Monodevelop did the trick for me. The issue started after I received an error regarding a DLL being unable to be moved or written to. This seemed to corrupt something and all is fine now. Thanks for the tips.
     
  19. gooncorp

    gooncorp

    Joined:
    Dec 30, 2011
    Posts:
    131
    yep it seems like this is broken which is a major problem. it appears that someone people half-way fix it, but that unfortunately is not good enough for this programmer. i will have to wait until unity technologies actually fixes this oh and by the way it also happens in 4.5.4. this has been the singlemost aggravating bug i have encountered yet in unity. even asking people to delete their library files is not even the right thinking in my opinion it is sidestepping the real issue which is that there is a feature not working in monodevelop. please fix it.
     
  20. Fredgdperry

    Fredgdperry

    Joined:
    Jul 26, 2012
    Posts:
    6
    I purchased the pro version thinking to use the profiler in tandem with the debugging tools.
    I had no idea the debugger would quit on me mid project just for editing my scripts while the debugger was paused.

    I've tried every *trick* to get things running again, but I feel this is an awful solution.
    Is there nothing done yet to fix the debugger?
     
  21. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Hi

    I'm currently looking into fixing this issue, I am however unable to reproduce it locally. Even so, I have attempted to fix the issue based upon the information provided by the users. I have attached a zip file with the potentially fix.

    Instructions:
    1. Make a backup copy of your Mono.Cecil.Mdb.dll and Mono.Cecil.Mdb.pdb in your MonoDevelop\bin directory.
    2. Copy Mono.Cecil.Mdb.dll and Mono.Cecil.Mdb.pdb from the attached zip file into your MonoDevelop\bin directory and override the existing files.
    Try to see if you can reproduce the issue and let me know if it is fixed. I also recommend that you copy back your original
    Mono.Cecil.Mdb.dll and Mono.Cecil.Mdb.pdb files once you are done testing, as this fix has not be undergone extensive testing yet.

    Lukasz
     

    Attached Files:

    clintonb likes this.
  22. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    972
    Hi Lukasz,

    that didn't help.

    I find it quite surprising that you cannot reproduce it locally, I can reproduce it pretty much 100% of the time on any of our company's machines.
     
  23. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    972
    Doubt this helps much, but to clear up any confusion as to whether it's some antivirus or what not, I just checked and when this occurs the only process with an open handle for the mdb file is MonoDevelop.exe.
     
  24. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Hi Alkis,

    Thanks for confirming that only MonoDevelop.exe has the .mdb open, this is very helpful and I now have a new approach to fixing this issue.

    Instructions
    1. Make a copy of your MonoDevelop\Addins\MonoDevelop.Debugger.Soft directory
    2. Extract the attached zip into your MonoDevelop\Addins\ directory and make sure it overrides the existing files in MonoDevelop\Addins\MonoDevelop.Debugger.Soft
    Try this new patch and see if this resolves the issue. I recommend that you restore your MonoDevelop.Debugger.Soft directory from your backup once you are done testing, as this patch has not undergone extensive testing.

    Lukasz
     

    Attached Files:

  25. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    972
    Hi Lukasz,

    So far, I have not been able to reproduce the issue with this patch installed, and it comes back after reverting to the backup, so I think you are probably on the right track. Considering this issue has been more intermittent for others, it would need more testing by other people affected to verify.

    Thanks for looking into this!

    Alkis
     
  26. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Great :)

    I will wait a few days and see if anyone else has issues with this patch before getting it into upcoming Unity 4.5/4.6/5.0 releases.
     
    Glabrezu likes this.
  27. Glabrezu

    Glabrezu

    Joined:
    Aug 30, 2014
    Posts:
    24
    It works now, I love you. Get it into the next release pls.
     
  28. derp9000

    derp9000

    Joined:
    Aug 20, 2014
    Posts:
    1
    Had this exact issue tonight. I am using Unity 4.5.5f1.
    I was having problems with my build settings previously kept reverting to .NET 3.5 on a rebuild all.
    I have fixed the breakpoints (perhaps temporarily?) by setting the project settings via the solution window.

    Right click on Assembly-CSharp in the solution window
    Select Options
    In the pop-up dialog select Build->General
    In the Target framework drop down select Mono / .NET 4.0
    Now do the same for the Assembly-CSharp-firstpass

    Hope the fix sticks
    Good luck
     
  29. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Fixed in the next Unity 5.0 and 4.6 release.
     
  30. McBain

    McBain

    Joined:
    Dec 17, 2013
    Posts:
    4
    lukaszunity,

    What version of 4.6 should this be fixed in? I'm running 4.6.0f3 and I'm seeing the issue.

    Thanks
     
  31. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    976
    I'm having this issue too in 4.6.0f3.

    I have tried removing library folder, removing MonoDevelop folder in %appdata%, restarting the computer... Doesn't work. Not even for new projects.
     
    Last edited: Dec 14, 2014
  32. McBain

    McBain

    Joined:
    Dec 17, 2013
    Posts:
    4
    After playing around, I noticed that if I try to place the Breakpoint in certain places, it shows up as a lighter pink. If that happens, I know it's not going to work. (IE not going to pause execution when I start the app.) For example, if I try to put it on a variable definition that is before the Start method. So maybe this is a feature and not a bug and I was just trying to use it incorrectly. I'm still learning how to use this confounded contraption. :)
     
  33. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    976
    That doesn't seem to be my issue. I'm unable to put a breakpoint within any method, in places where I've been able to before.

    I found a post somewhere saying that if you open the project in UnityVS, and then go back to MonoDevelop, then it starts working. Well, that worked for me. Now I'm able to debug again.
     
    Last edited: Dec 14, 2014
  34. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    976
    Well I think I found the cause. If you change this dropdown (to any selection) you won't be able to debug anymore. I'm not sure how to reset it. Only solution so far is to open project in UnityVS.

     
  35. clintonb

    clintonb

    Joined:
    Dec 14, 2013
    Posts:
    15
    Thank you, Lukasz.

    Your steps in post #71 worked for me. After hours trying to set a breakpoint so I could spend a few minutes understanding a problem, I nearly cried when it worked.

    (I'm using Unity 4.6.0p1 on Mac OS 10.10.0, BTW)

    I'm so grateful that a proper fix is in the works.
     
  36. frozenlogic

    frozenlogic

    Joined:
    Sep 3, 2013
    Posts:
    14
    Hi, same problem here on Unity 5.5.0. I have to reimport assets all the time to get debug working.