Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Unity Debugger Extension for Visual Studio Code 2.0.x Preview Release

Discussion in 'Experimental Scripting Previews' started by miniwolf_unity, Apr 11, 2018.

  1. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    I tried doing this on the newest version of the editor, using both 3.5 and 4.x runtime. Here, it would not crash, but it would stop execution without any warning, compile error or notice to me what had happened. I have filed a new bug report, and will follow up with this problem. On windows, however, this will produce a stack overflow, as expected. So apparently we are suppressing this message on Mac OSX.
    I can check if your bug has been reported if you private message me your email with which you reported the problem.

    Thank you for the issue report on Github, if another person encounters the same problem we may hopefully get some more information.
     
    Last edited: Jun 8, 2018
  2. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    @talyh I have verified that the bug you are referring to has been resolved in the mono runtime, so at some point when the new version of mono is merged into Unity, it will be resolved. However, it will not be backported to the old 3.5 runtime. But it will work on the new stable 4.x release.
     
  3. talyh

    talyh

    Joined:
    Dec 2, 2016
    Posts:
    20

    That's really good news! And thanks for the follow-up!
     
  4. greay

    greay

    Joined:
    Mar 23, 2011
    Posts:
    88
    When I try to add an exception breakpoint, I get the error:
    command 'exceptions.addEntry' not found

    VSCode 1.24.0
    Debugger for Unity 2.6.0
    macOS 10.13.6
     
  5. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    Do you try to add an exception breakpoint before or after attaching to Unity?

    Just to let you understand how things works in VS Code. The extension has an `activate(context: ExtensionContext)`. Where you add commands to (like 'exception.addEntry'). So if the debugger is not started, the "extension" is technically not started yet. So therefore most of the commands are not loaded yet.

    However after first time, attaching a debugger you can add exception breakpoints before you attach the next time. Because the command has been initialized through the activate method.
     
    Last edited: Jun 15, 2018
  6. greay

    greay

    Joined:
    Mar 23, 2011
    Posts:
    88
    oh, okay, that's a little weird, but that did seem to fix it. but now I seem to have gotten myself into a situation where the debugger no longer stops on any breakpoints.

    I don't, at the moment, have any exception breakpoints set. It's just normal line number breakpoints, like worked in previous versions. But the debugger just blows right past them. Neither restarting VSCode nor Unity gets it working again.

    Not to mention, I haven't even got the exception breakpoints to work. With the basic System.Exception breakpoint set, I'm unable to start the debugger before launching my game in the Editor, as I usually do. If I try that, it will pause on all sorts of Unity exceptions and show "source file not found" files, never actually making it to my own code before I give up.

    Also, quite a few "Debug adapter process has terminated unexpectedly" errors. Which usually ends up with Unity locked up, so I have to force-quit it & relaunch. Over and over again.
     
    Last edited: Jun 16, 2018
  7. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    I am sorry that you are having soo many problems with this. :/ If you can narrow some specific cases down, with a small reproducible project that helps me debug the problem. You can paste this on the github issues page. Then I can see if I can help you resolve some of the issues.
     
  8. Shaba1

    Shaba1

    Joined:
    Jan 21, 2010
    Posts:
    63
    miniwolf_unity: First thanks for a new addon for unity. I downloaded and installed this debugger for vscode and unity.


    #1. But when I go to the vscode extensions panel and look at the changelog for within vscode it says that the last change was up to version 1.3.1 I say is the most recent version. Is the vxix file that you posted even more recent?

    #2 could you go over the actual process of debugging within unity. What I mean is do you press play in the unity editor first, then open the script in vscode then start the debugger OR do you start the unity editor,open the script in vscode, set breakpoints, the go back to the unity editor and press play??
    Sometimes I get confused on the order that things should be done, and unity locks up. I have to ctrl-alt-delete and shut down unity and vscode and restart from the beginning.

    #3 Sometimes when you are in debug mode and step thru code when you are suppose to supply input in unity, I go to the unity editor and press the designated input key and nothing happens in either unity or the debugger. Is that normal?

    #4 Can you make a video screen cast of using the debugger in unity, I can find lots of videos about using the Visual Studio debugger<not code> or general use of the vscode debugger(json files,python files, c# file e.t.c) but nothing specific to vscode and unity debugging.

    Thanks

    PS.

    #5 One more thing. When I do get the debugger running with these two scripts:

    https://drive.google.com/open?id=1_5BJ0xKfs9J-AAvP8s2s7ZNlnXESUgiM

    https://drive.google.com/open?id=140tZi6BGcFGiAWasfWUU4srqDZlFKHyZ

    and this project:

    .https://drive.google.com/open?id=1iSPudHqcHLHq_Cs7cDHRTktsljbgTBUJ

    I get the debugger to stop at the appropriate breakpoint but in the variables portion of the debugger explorer I get all kinds of orange text showing unity internal variables, I am only interested in the variables that I use in my script. Is there anyway of turning that other stuff off?

    I hope that this rambling post makes sense to someone.

    Thanks again.
     
    Last edited: Jun 28, 2018
  9. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    The vsix file contains a link to the Github page where I am posting the preview releases currently 2.6.1.

    The debugger only needs unity to be started. This means that you do not necessarily have to press play before attaching the debugger, as editor scripts can also be debugged through this debugger. So attaching the debugger to unity, setting a breakpoint and then pressing play is a valid workflow.

    If you are hitting a breakpoint then you should not be able to return to Unity, because it will lock the process. If you are not currently on a breakpoint, and then interact with unity it will call back to the debugger when it reaches a breakpoint, or the next line if you are calling step forward.

    We have been talking about this internally, generating some tutorials, for beginners and intermediate programmers on how to debug using Visual Studio, Visual Studio Code, Rider and so on. But this is something marketing is working on, planning, etc. So I cannot promise you immediate results, especially when we are reaching summer vacation time here in Copenhagen.

    Not currently no, to make things simpler, implementation wise, there is no distinction between unity internal variables and user defined ones. There would have to be a notion of what base type are external and what are internal. Like MonoBehaviour would be an example of a base type, whose variables would have to be filtered. So the short answer is no, the longer answer is that it could be a feature that may be possible, but I don't have an idea of how that would work.
     
  10. Shaba1

    Shaba1

    Joined:
    Jan 21, 2010
    Posts:
    63
    thanks miniwolf_unity. I have version 2.somthing running very well now and it is really usefule. As I said, the only real problem is unity locking up sometime. But I think that is because I do not really know how to use the debugger well. And the internal variables being displayed. It is a real pain having to scroll thor all the variable list just to see the one that I want to track.
     
  11. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    @Shaba1 what you can do is add the variables you want to follow in the watch list. This should help minimize the amount of things you need to scroll through.
     
  12. gabrieloc

    gabrieloc

    Joined:
    Apr 6, 2014
    Posts:
    49
    For anyone who finds this thread because breakpoints stopped working sporadically - a (working) interim solution is to toggle specific breakpoints off and back on after starting your debug session. Unfortunate but works..
     
  13. tchris

    tchris

    Joined:
    Oct 10, 2012
    Posts:
    133
  14. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    And is unity running when you try to debug?
     
  15. tchris

    tchris

    Joined:
    Oct 10, 2012
    Posts:
    133
    Yes the Unity editor is running. My game is not running though (I'm assuming that's the correct way to do it)

    I'm on Windows if that helps at all
     
  16. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    Yes that is one of the supported work flows. Could you post an issue on Github? https://github.com/Unity-Technologies/vscode-unity-debug/issues Then I will help you get this resolved.
     
    tchris likes this.
  17. jokigenki

    jokigenki

    Joined:
    Jul 19, 2014
    Posts:
    41
    This is the only thing that allows me to debug. It fails to stop on breakpoints almost always if I just run the debugger and then hit play in Unity. [Unity 2018.1.2f1, Debugger For Unity 2.6.3, same on both Windows and OSX]
     
  18. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
  19. daniel254973

    daniel254973

    Joined:
    Jun 9, 2016
    Posts:
    8
    Hello,

    custom breakpoints (expression evaluation, logs and hit counts) don't work properly. They all work like usual breakpoints, am I missing something?
     
  20. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    @daniel1112 I am going to need a lot more context here. Expression evaluation, also known as conditional breakpoints, should work. There are a few circumstances where there are some known issues which has been reported to Microsoft.
    Log hits and hit counts have not been tested, so I cannot say whether that has been working before.
    If you have some specific issues I would be glad if you would post it on the Github page so I can try to resolve them for you: https://github.com/Unity-Technologies/vscode-unity-debug/issues
    Most of all if you have some small reproducable projects, then I would be very happy.
     
  21. daniel254973

    daniel254973

    Joined:
    Jun 9, 2016
    Posts:
    8
    Oh, I just checked you can have expression evaluation and log points at the same time. If there is only a conditional breakpoints it works correctly.

    Logpoints and hit counts don't work. Breakpoint is marked with an exclamation mark and tooltip says Logpoints not suported by this debug type.

    Thanks for your help.
     
  22. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    @daniel1112 no worries. If you think logpoints and hit counts are necessary features you can make a feature request on the github page. Then it will be put on the backlog.
     
  23. jokigenki

    jokigenki

    Joined:
    Jul 19, 2014
    Posts:
    41
    @miniwolf_unity hi, sorry for the late reply. I set up a test project from scratch to see if I can repro the problem, but it seems to work fine in that. The project I'm working on has been upgraded through multiple versions of Unity, and started out as a .Net 3.5 project. Could there be some issue with my Unity or VSCode set up?
     
  24. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    @jokigenki hey again joki.
    It is difficult to say where the specific problem lies. I think it is important to eliminate as many problems as possible, so staying up-to date with VSCode and the debugger extension is one step. I keep finding small issues, so hopefully with time either through luck or if someone else has a repro project that I can use to detect the problem we can solve it.
     
  25. jokigenki

    jokigenki

    Joined:
    Jul 19, 2014
    Posts:
    41
    Hi, I updated to the latest (2.6.4) and it seems to be much more stable for me now. Thanks for your hard work!
     
    miniwolf_unity likes this.
  26. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    That is awesome! Hope it will continue that way :)
     
  27. AbidAli

    AbidAli

    Joined:
    Sep 6, 2018
    Posts:
    2
    I'm using Unity2018.1.5f1 andVisual Studio Community 2017 for Mac Version 7.6.3 (build 1)

    Every time I attach the debugger it with Unity process and play unity project, it gives me a popup saying Debugger runtime is not responding. You can wait for it to recover, or stop debugging.

    Apparently I've tried all solutions from the internet, from this thread but nothing is working. Any help will be highly appreciated.

    Pls see the attached screenshot as well.
     

    Attached Files:

  28. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    @AbidAli yeah that does not look very good. Though this post is about Visual Studio Code and not Visual Studio for Mac.
    Could you maybe try to reduce your project, to make a smaller reproducible project and then make a bug report about it through Unity? Then I will at least make sure to figure out whether it is something that we can take care of. If not then I will make sure that this problem gets sent to the VSfM guys.
     
  29. SirIntruder

    SirIntruder

    Joined:
    Aug 16, 2013
    Posts:
    49
    Anything blocking this from being released on vscode store? It's still 1.3.0 there.
     
    andrzej_cadp and rakkarage like this.
  30. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    @SirIntruder
    It is planned for marketplace release monday 15th October. I am waiting for some feedback on attaching to player connection and some refactoring that has been done on setting breakpoint.
    Following this new releases and fixes will be pushed through the marketplace when they arrive.
     
    khaled24, SirIntruder and rakkarage like this.
  31. Deleted User

    Deleted User

    Guest

    Digging up an old thread.

    Linux editor: I just installed the debugger for Unity from the marketplace and I get this error message:
    Code (CSharp):
    1. Cannot activate the 'Debugger for Unity' extension because it depends on an unknown 'ms-vscode.csharp' extension .
    What must I do?

    Edit: I downgraded to version 1.3.0 and the message disappeared.
     
    Last edited by a moderator: Mar 12, 2020
  32. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    136
    The issue is being discussed here: https://github.com/Unity-Technologies/vscode-unity-debug/pull/152
    There is a workaround while we are testing the fix.
     
    Deleted User likes this.
  33. Deleted User

    Deleted User

    Guest

  34. Danebulus

    Danebulus

    Joined:
    Jul 3, 2017
    Posts:
    5
    For Unity 2018, it seems that the last working "Debugger for Unity" version is 2.7.5
    Three months I have tried everything I could think of. No matter what I try, it doesn't work for me with the newer "Debugger for Unity 3.0.2".
     
  35. AlternativeShit

    AlternativeShit

    Joined:
    Feb 17, 2021
    Posts:
    18
    I'm trying to set up the debugger and I can't seem to make it work. It doesn't stop at the breakpoints when I run the game, and doesn't show any variables...

    My debug console says that it's attached to unity editor but whenever i play the game, it won't do anything of my breakpoints...

    I'm using v2018.4.31 of Unity and v3.02 of Debugger for Unity

    Any idea why?
     
    Last edited: Mar 15, 2021
  36. AlternativeShit

    AlternativeShit

    Joined:
    Feb 17, 2021
    Posts:
    18
    Well now it stops to the first breakpoint, but I can't step over, step into, or step out...?

    If someone knows why this could be happening, I'll be more than happy to hear your solution :)

    edit : also my breakpoint icon isn't yellow or highlighted, even though my game stops at the right breakpoint. It's still a red circle. Not highlighted like in this video at 4:25 :

     
    Last edited: Mar 16, 2021