Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Clicking on Debug.Log console output doesn't me to the corresponding source code line

Discussion in 'Scripting' started by TokyoDan2, Jun 9, 2014.

  1. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
    Clicking on a Debug.Log statement output in the console no longer takes me to the corresponding line in the source code in MonoDevelop. This makes it impossible for me to debug.

    This is after upgrading from Mountain Lion to Mavericks and from Unity 4.3.4 to 4.5.0.

    Is anyone else having this problem? Is there some setting that controls this?
     
  2. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,249
    In the preferences under external tools, check the location is correct.
     
    GibTreaty likes this.
  3. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
    The location is correct.

    And I've tried everything I read in these forums. 1. Uninstalling all Unity and Monodevelop apps/prefs, then reinstalling...already three times. 2. Manually setting the external tools editor via Browse to Monodevelop. 3. Moving Monodevelop up one level in the directory tree.

    Nothing works and I cannot work like this. Clicking on a Debug.Log statement output in the console will open the proper C# source file but it also positions the cursor at the very first line in the file but not to the corresponding Debug.Log statement that outputs to the console that I clicked on. I uses this to trace program flow but now I can't.

    Damn! Why did I upgrade!
     
  4. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
    Ha. I introduced an error in my program and clicking on that error in the console will take me to the exact line. So maybe Unity or Monodevelop has changed what it does with Debug.Log statements.

    And it must be Unity that has changed because the Monodevelop version is the same (4.0.1) one I was using in Unity 4.3.x before the upgrade to 4.5.
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It works the same as always here. (OS X 10.9, Unity 4.3 and Unity 4.5.)

    --Eric
     
  6. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
    Eric. Is that on Mavericks? How did it work for you before? Could you click on a Debug.Log statement output in the console and be taken to the corresponding line in the corresponding source code in MonoDevelop. (I don't mean errors in the console...that is OK)
     
  7. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
    Boy. This pretty much kills my way of working. I can not continue with Unity the way it is now. A year and a half of work down the drain.
     
  8. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, 10.9 is Mavericks. Clicking a Debug.Log statement goes to the corresponding line. I would have thought Debug.Log and errors are basically the same thing, in terms of going through the same log system. What happens if you use Debug.LogError? Or Debug.LogWarning?

    --Eric
     
  9. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
    Debug.LogWarning doesn't work either.
     
  10. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    I use 4.5.0f6 on Mavericks 10.9.2. I have the vanilla version of MD that was installed alongside 4.5.0f6. Clicking debug log messages does take me to MD and shows me the correct line. (If it didn't I'd look for the line number in the console window, and find it in MD. Sure that's annoying, but will mean my 18 months of development isn't down the drain.) It's probably worth submitting a bug report with a short video that shows your MD not finding the correct line.
     
  11. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
    Simple Debug.Log statements like Debug.Log("Just entered this function\n"); don't show a line number. Therefore I'd have to select the output in the console, copy it, paste it into a search dialog in MD and do a search. THAT is way too much trouble and takes waaaaay too much time. Especially when you have hundreds of Debug.Log statements outputting to the console and depend on that output to trace program flow in an online multiplayer game that is getting callbacks from the server. And you hope those callbacks are in the correct order and in response to what you hoped that you did correctly.

    I'll just put things on hold till this issue is solved. I don't like to do things the hard way, especially when I know that there is supposed to be an easier and more sensible way that doesn't work anymore.

    If I don't get some answers by tomorrow I'll take your advice and make that visual bug report.
     
  12. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287

    I see the line number. If you're not seeing this, then I suspect something is borked in your editor, in which case getting a bug report in is going to make the most sense.
     
  13. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
    Ah. That's right...if you don't end a string with a "\n" which I always do. I forgot about that.
     
  14. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Well, the line number is always printed regardless of ending a string with "\n", as shown in Graham's screenshot (at the bottom, specifically the ":37" part).

    --Eric
     
  15. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
    --Eric. No it doesn't. If you are using just a string that ends with "\n" (or concat the object with a string that ends with "\n" you will only get ONLY one line of output...the string, or the object representation in text plus the concerted string. The "\n" at the end of the string is expressly used to get rid of those extra Debug.Log() lines of output which includes the stacktrace and line number.

    Read the 4th post by Michael Ryan on this page: http://forum.unity3d.com/threads/debug-log-and-needless-spam.38720/

    Anyway I got rid or the "\n" at the end of the string in my Debug.Log() statement and it does give me a line number so I guess MonoDevelop isn't borked too badly.
     
  16. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That's not the case; the message you're referring to even says so:

    e.g., this code:

    Code (csharp):
    1. Debug.Log ("test\n");
    results in this:



    Where you can see that it prints that it's on line 4. It never prints the line number in the top part, regardless of whether you use "\n" or not; the line number is always printed at the bottom when you select a specific message. The only thing using "\n" ever does is remove the "UnityEngine.Debug:Log(Object)" from the top part.

    --Eric
     
  17. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
    I think we may be talking about two different things. In the top pane (the one I've been talking about) you only get 1 line. That is the line you have to click on to get to the corresponding line in MonoDevelop. Clicking on the line in the bottom pane does nothing.
     
  18. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
  19. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
    Looks like my problem is back and now no matter what I do or what version I use does not help. Damn!
     
  20. TokyoDan2

    TokyoDan2

    Joined:
    Apr 23, 2014
    Posts:
    19
    I'm really sick of this now. I don't want a try this, try that, uninstall everything, clean out the prefs and library, reinstall everything, mix and match Unity/MonoDevelop version. All I want is a simple F***in' fix! There's got to be some config file or some setting somewhere that is broken. And the Unity engineers must know what would cause this.
     
  21. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    That problem is back. I don't know what I did to get it back. This has never happened in a year and a half of using Unity and constantly upgrading until now.

    Three full days now trying to solve this problem. I can't work on my game till this is fixed. I am completely and utterly screwed!
     
    Last edited: Jun 11, 2014
  22. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    I found a way to deal with this, I'm booting from an external firewire drive with Mountain lion, older versions of Unity + MonoDevelop and that works perfectly.

    I'm done with this problem and spent too much time on it already. I'll wait until someone else fixes it and I don't want a try this, try that, uninstall everything, clean out the prefs and library, reinstall everything, mix and match Unity/MonoDevelop versions. All I want is a simple fix, not a hack. There's got to be some config file or some setting somewhere that is broken. And the Unity engineers must know what would cause this.
     
  23. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Unity uses AppleEvents to talk to MonoDevelop. From the Unity side, I can see these events being sent. I've been trying to find a way to allow us (you and me) to debug what is happening, or not happening, on your machine. When talking to MonoDevelop in response to a console event, two AppleEvents get sent. The first pokes MD to make it reload the project. This event does get sent with a line number of 1. The second event tells MonoDevelop to open the file and go to the line number. I'm assuming this second AppleEvent gets lost somewhere. (Google tells me about
    AEDebugSends and AEDebugReceives, but I can't seem to get MonoDevelop to spit out received events.)
     
    TokyoDan likes this.
  24. mitananda

    mitananda

    Joined:
    Feb 11, 2014
    Posts:
    19
    i think it's better if you use other tool editor like Visual studio or notepad maybe
     
  25. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The topic is about MonoDevelop on OS X, so no, that wouldn't be better.

    --Eric
     
  26. mitananda

    mitananda

    Joined:
    Feb 11, 2014
    Posts:
    19
    i have problem like you too, so i change to use visual studio tool editor so the problem solved.. why did you create a headache, if hard find other alternatives.using visual studio its better.
     
  27. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Because we're talking about OS X, which doesn't have Visual Studio.

    --Eric
     
    twobob likes this.
  28. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    The Firewire external drive was way too slow so I Installed Xamarin Studio 5 and am using that as Unity's external text editor and that (FINALLY) works. Shows that Unity is screwing up by not keeping up to date. I think they are spreading themselves too thin by trying to cover so many platforms and trying to be all things to everybody. Reminds me of Sony in the early 80s. In the 70's Sony had great reliable products..when all they made were transistor radios high-end stereo equipment and Trinitron TVs. Then when they started making Walkmans, computers, and everything else, their products went downhill real fast. I never had a Sony product that didn't have problems or break within two years. I used to teach an Electronics shop owner English here in Tokyo. They sold all brands. He told me Sony products had the most problems.
     
  29. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    That is the best explanation I've heard. Thanks Graham.

    But it seems that MonoDevelop may be ignoring that second AppleEvent because Xamarin Studio is getting it...so surely Unity must be sending it. BTW..Sublime Text 2 acted the same as MonoDevelop... it always opens the correct script but not at the correct line number. Hmmm. Maybe it is Unity and it does something different depending on what external Text Editor it is pointing to.

    Hmmm. Or maybe this...

    When I installed Xamarin Studio it set itself as Unity's external text editor because after installing Xamarin Studio I went into Unity's Prefs to set it as the external text editor but it was already set...I din't have to do anything... so maybe Xamarin is patching something in Mavericks (or in Unity).
     
  30. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    Ha. Just for the heck of it I set Unity's external script editor back to MonoDevelop built-in.. ran a script and clicked on the Debug.Log() output in the console and Unity opened MonoDevelop at the welcome page only AND opened Xamarin Studio with the correct script BUT without highlighting the corresponding Debug.Log() statement. The cursor stayed at the top of the file. (It may have opened XS because my .cs files are now set to open with XS).

    Then I went back to Unity's Prefs and again set XS as my external script editor, did the same test, but this time Unity opened XS with the corresponding script AND at the correct Debug.Log() statement in the script.

    Jeesuz H. Christo! Whats a mess.

    Anyway. Thank God that it works with XS.
     
    twobob likes this.
  31. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    +mitananda Your workaround works! And that is good for now. I'm tired of doing Unity's work for them...without pay.
     
  32. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    I installed Xamarin Studio 5.0 and that works like a charm. Even my Logicool Mouse scroll wheel works again (It didn't work in MonoDevelop 4.0 on Mavericks. But it was OK with MD 4.0 on Mountain Lion. Weird S***.)
     
  33. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    (Just for the record, I spent 3 hours debugging through the Unity source code last night, in my own time, in order to help you as best I could. I don't get paid over-time. What I did notice is that if I launched MonoDevelop.app using open, then Unity would talk to it. If I launched the executable directly, by using open ...blah/MonoDevelop.app/Contents/MacOS/monodevelop then Unity would open a new instance of MD. I was doing this second approach to look at the AppleEvent messages.)
     
  34. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    +Graham sorry for my nasty comment but that is just the way I feel these days with the overall state of the software industry since electronic distribution allowed devs to ship stuff early with bugs thinking they could leverage their customers as an informal and unpaid beta testing team... Maybe Unity is not like that but you know what I mean. And thanks for your help. You are making me think that things are maybe better than what I'v been thinking lately.

    BTW. Xamarin Studio is FAR from perfect. It is prone to slowdowns so bad that I think it has hung.
    Also I noticed that Unity has released an update..4.5.1. Could this possibly solve my MonoDevelop problem?
     
    Last edited: Jun 14, 2014
  35. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Check the release notes, but I don't think the 4.5.1 release or the 4.5.1p1 patch release have MonoDevelop fixes for your issue. Fixing bugs requires the issue to be reproducible so the devs can see changes to the source code changing the behaviour.
     
    twobob likes this.
  36. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    +Graham Thanks for your time and help.

    Yeah I tried 4.5.1 and it made no difference. And in the meantime Xamarin Studio is almost unusable in a different way...it is prone to slowdowns so bad that I think it has hung. So I bought Script Inspector 2 last night hoping that that will tide me over till my issue gets fixed.

    BTW. Are there any system logs or anything that I can send that would help finding the problem? Too bad this is not reproducible on every system. The thing is. I completely reformatted my disc and did a clean install on Mavericks. And Unity was the first non-Apple application that I installed.
     
  37. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    FYI. I'm now trying Script Inspector 2 and I can click on the output of a Debug.Log statement in the Unity console and it opens the corresponding script and highlights the corresponding line. But of course it doesn't support the other niceities like MonoDevelop does like showing where something is defined or the references to it.
     
  38. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    Either opening a script file in MonoDevelop by clicking it in the Project pane or by clicking some output in the Unity Console causes these messages to show in the system.log:

    Jun 17 11:05:00 iMac27.local launchservicesd[56]: Ignoring notification of asn=[ 0x0/0x8a08a] pid=5549 because it matches an existing app App:NULL or App:"MonoDevelop-Unity" asn:0x0-85085 pid:5549 refs=6 @ 0x7f9543d86e90 : LASApplication.cp #883 CreatePendingApplication() q=LSSession 100004/0x186a4 queue
    Jun 17 11:05:00 iMac27.local launchservicesd[56]: Ignoring notification of asn=[ 0x0/0x8b08b] pid=5549 because it matches an existing app App:NULL or App:"MonoDevelop-Unity" asn:0x0-85085 pid:5549 refs=8 @ 0x7f9543d86e90 : LASApplication.cp #883 CreatePendingApplication() q=LSSession 100004/0x186a4 queue
     
  39. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    After clearing com.apple.LaunchServices.plist and rebuilding the desktop (Starting up while holding down shift key) the first time I startup Unity I get these error messages:

    Jun 17 13:38:15 iMac27.local Unity[316]: NSDocumentController Info.plist warning: The values of CFBundleTypeRole entries must be 'Editor', 'Viewer', 'None', or 'Shell'.
    Jun 17 13:38:16 iMac27.local mDNSResponder[35]: Bad service type in iMac27._unityiphoneremote._tcp.local. Application protocol name must be underscore plus 1-15 characters. See <http://www.dns-sd.org/ServiceTypes.html>
    Jun 17 13:38:16 iMac27.local mDNSResponder[35]: Bad service type in ._unityiphoneremote._tcp.local. Application protocol name must be underscore plus 1-15 characters. See <http://www.dns-sd.org/ServiceTypes.html>
    Jun 17 13:38:16 iMac27.local mDNSResponder[35]: Bad service type in iMac27._unityiphoneremote._tcp.local. Application protocol name must be underscore plus 1-15 characters. See <http://www.dns-sd.org/ServiceTypes.html>
    Jun 17 13:38:26 iMac27.local WindowServer[115]: disable_update_timeout: UI updates were forcibly disabled by application "Unity" for over 1.00 seconds. Server has re-enabled them.
     
  40. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    Could this have something to do with my problem?

    "Apple Secures Mac OS X with Mavericks Release"

    This paragraph about sandboxing sounds like it does:

    "The approach known as "sandboxing" isolates processes from each other and the underlying operating system in a bid to reduce risk. As it turns out, Mac OS X prior to the new 10.9 update was vulnerable to an App Sandbox bypass.

    "The LaunchServices interface for launching an application allowed sandboxed apps to specify the list of arguments passed to the new process," Apple stated. "A compromised sandboxed application could abuse this to bypass the sandbox."
     
  41. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    I am experiencing exactly the same issues as TokyoDan. No matter what I do Monodevelop will not jump to the correct line. OSX10.9.4 on retina macbook pro with unity 4.5.1p3. I have tried all the same hack-fixes and the ONLY way to get it to jump to a the correct line is to use Xamarin Studio. Highly frustrating and suggestions to "read the line from the console" is really useless.

    Xamarin Studio is a little more sluggish than MD but being able to jump to the correct code-line makes this a no-brainer.

    TokyoDan did you ever get a bug report case number for this or should I make a new one?
     
  42. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    I filed a bug report...
    http://fogbugz.unity3d.com/default.asp?613056_ko51b2i4tpbkvgkf

    I could never solve the issue and Xamarin was too sluggish so I ended up doing a clean install of Mountain Lion on an external firewire drive. And I also installed the latest Unity with its default MonoDevelop on the external firewire drive.

    Normally I boot into the default Mavericks on my internal iMac drive but when I want to develop for my game I boot into Mountain Lion from the external drive. And Unity+MonoDevelop works perfectly on Mountain Lion!

    Seems like the problem is with Unity 4.5.x + Mavericks combo

    (P.S. The external firewire drive I'm using is the Western Digital My Passport Studio. It's a great drive and cheap on Amazon:).
     
  43. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    cool man thank for the tip, might have to do that too
     
  44. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    374
    I'm also experiencing the same issues (no line jump, MonoDevelop gets opened alongside the default script editor connected to cs files, and it doesn't open the solution). So basically my MonoDevelop is always open in two instances (if I close one, it gets opened again), and I have to search for the line and open solutions manually when switching projects.

    All these issues except the two instances problem happen since I updated to mavericks (=more than half a year ago), and I'm a bit sad to see that something that essential is still not fixed, even after many bug reports and forum posts..
     
  45. AmazingRuss

    AmazingRuss

    Joined:
    May 25, 2008
    Posts:
    933
    Have been having this problem with 4.5.2, or similar anyway. It opens the file in mlnodevelop, but does not jump to the line.
     
  46. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    There's clearly a problem with the way that events are passed from Unity to MonoDevelop. I'll get the QA team to try and replicate.
     
  47. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    Graham. Thanks!
     
  48. laurelhach

    laurelhach

    Joined:
    Dec 1, 2013
    Posts:
    229
    I don't know if this is worth to say, but it happens to me too sometimes (not always).
    Win7 64b Unity 4.5.1.
    When I double click I go to the script tab (in mono), but to the first line. If I click again on the error, I jump to the correct line.
     
  49. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    thanks graham!
     
  50. BroVodo

    BroVodo

    Joined:
    Oct 2, 2012
    Posts:
    52
    I noticed a similar effect on windows/unity 3.53 if you copy an entire project and open the new copy in unity. Going back to the old project fixed the error.

    Similar effect = clicking on Debug.log output in console window doesn't open or switch to monodevelop

    Might help someone