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

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

Discussion in 'Experimental Scripting Previews' started by miniwolf_unity, Apr 1, 2019.

  1. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    100
    A new version of the Unity Debugger Extension for Visual Studio Code is being released here for early testing and feedback. The debugger extension has been upgraded to the latest debugger libraries to provide a better debugging experience and try to address some of the issues found by users.

    This new release is targeting a few missing features such as LogPoints and increasing stability on the debugger in general. Follow the release notes below.

    Please report any kind of feedback in this thread and help us track issues by reporting them on the GitHub repo: https://github.com/Unity-Technologies/vscode-unity-debug/issues

    Download
    If you need to download an earlier release please visit the GitHub page and download them from the release page. You can also use the stable version found on the marketplace. This link will be kept up-to date with the latest version at all times.

    Installation

    Warning: Installing this version will override your existing Unity Debugger extension.

    The provided .vsix file can be manually installed from inside VS Code by following these instructions:
    • Open your workspace, in the extension tab in the left menu.
    • Here you can open settings on the three dots in the bar with the name Extensions.
    • Click install from VSIX
    How to uninstall
    • Go to the extension tab.
    • Click on the cogwheel next to the Debugger for Unity 3.0.1 under installed.
    • Choose to uninstall.
    Release notes
    ===3.0.1===

    • Added support for logpoints.
    • Fixed several evaluation bugs
    • Added LINQ support in evaluation.

    Minimum Requirements
    Supported on all Unity versions. For the best debugging experience with .NET 4.6 runtime we recommend using Unity 2018.1 and above.​

    Source code repositories

     
  2. SirIntruder

    SirIntruder

    Joined:
    Aug 16, 2013
    Posts:
    43
    I've installed this and logpoints are very cool :)
    I've noticed that editing logpoints during one session is ignored and opened an issue on github
    Deleting and adding new ones during the session seems to work correctly
     
  3. cooptwostar

    cooptwostar

    Joined:
    Jan 9, 2019
    Posts:
    1
    Hello, just wondering if development on this extension is still active. 3.0.1 has been a good improvement, but the VsCode debugger is still quite unreliable and is would greatly benefit from additional development. At the very least, I think it would be a good idea to release version 3.0.1 on the extension marketplace so that the majority of VsCode users could benefit from the improvements, unless there have been some regressions that others have run into.
     
  4. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    100
    @cooptwostar yes this is still being worked on. However, only by me, so I only have the time I don't spend on my other tasks. So it is not going as fast or as smoothly as I would like. But I am still actively working on it.
     
    cooptwostar likes this.
  5. successeven

    successeven

    Joined:
    Mar 24, 2018
    Posts:
    1
    hi! What about debug when multiple instances of Unity are open?
     
  6. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    100
    @successeven this should work. You can open the command pallette and use the command> "Unity Attach Debugger". That will open a list of open editors and players that you can choose to attach to.
     
  7. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    429
    @miniwolf_unity just to confirm, are we supposed to be able to debug using Mac VSCode attaching to an IL2CPP iOS build? The current v2.x and this new v3.0.1 connect and then a few seconds later disconnect. We can attach to the Editor and debug fine.

    VSCode output;
    UnityDebug: Initializing
    UnityDebug: Searching for Unity process 'iOS Player'
    UnityDebug: Attached to Unity process 'iPhonePlayer(XXX-iPhone-5S):56000' (130992214)
    UnityDebug: Disconnected

    https://github.com/Unity-Technologies/vscode-unity-debug/issues/130

    I also tried Visual Studio for Mac and got errors similar to issues like:
    https://github.com/Unity-Technologies/vscode-unity-debug/issues/103 ("Operation is not valid due to the current state of the object").

    We've updated / uninstalled / reinstalled stuff, checked firewalls, disabled cellular connections, etc. as suggested in a few of your posts and github issues.
     
    Last edited: Aug 22, 2019
    BinaryByron likes this.
  8. BinaryByron

    BinaryByron

    Joined:
    Sep 16, 2016
    Posts:
    6
    I've never been able to get the debugger to connect to any of the Players. Seems even Visual Studio cannot find the players when using 'attach to process', none of the players are listed. Here's the log, logcat screen shot attached. Using unity debugger 3.0.1:

    `
    12:21:25.393823: Log
    ---

    12:21:25.433330: UnityDebug
    12:21:25.436785: Running session
    12:21:25.460713: Constructing UnityDebugSession
    12:21:25.473188: Done constructing UnityDebugSession
    12:21:25.749315: Command: initialize: {
    "clientID": "vscode",
    "clientName": "Visual Studio Code",
    "adapterID": "unity",
    "pathFormat": "path",
    "linesStartAt1": true,
    "columnsStartAt1": true,
    "supportsVariableType": true,
    "supportsVariablePaging": true,
    "supportsRunInTerminalRequest": true,
    "locale": "en-us"
    }
    12:21:25.834326: Command: attach: {
    "name": "Android Player",
    "type": "unity",
    "request": "attach",
    "__exceptionOptions": [
    {
    "path": [
    {
    "names": [
    "System.Exception"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.SystemException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.ArithmeticException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.ArrayTypeMismatchException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.DivideByZeroException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.IndexOutOfRangeException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.InvalidCastException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.NullReferenceException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.OutOfMemoryException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.OverflowException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.StackOverflowException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.TypeInitializationException"
    ]
    }
    ],
    "breakMode": "never"
    }
    ],
    "__sessionId": "4f8c79d2-d427-4c99-814f-6e5980a932f2"
    }
    12:21:25.837248: UnityDebug: Attach: VSCodeDebug.Response ; {
    "name": "Android Player",
    "type": "unity",
    "request": "attach",
    "__exceptionOptions": [
    {
    "path": [
    {
    "names": [
    "System.Exception"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.SystemException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.ArithmeticException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.ArrayTypeMismatchException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.DivideByZeroException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.IndexOutOfRangeException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.InvalidCastException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.NullReferenceException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.OutOfMemoryException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.OverflowException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.StackOverflowException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.TypeInitializationException"
    ]
    }
    ],
    "breakMode": "never"
    }
    ],
    "__sessionId": "4f8c79d2-d427-4c99-814f-6e5980a932f2"
    }
    12:21:25.858207: UnityDebug: SetExceptionBreakpoints: [
    {
    "path": [
    {
    "names": [
    "System.Exception"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.SystemException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.ArithmeticException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.ArrayTypeMismatchException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.DivideByZeroException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.IndexOutOfRangeException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.InvalidCastException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.NullReferenceException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.OutOfMemoryException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.OverflowException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.StackOverflowException"
    ]
    }
    ],
    "breakMode": "never"
    },
    {
    "path": [
    {
    "names": [
    "System.TypeInitializationException"
    ]
    }
    ],
    "breakMode": "never"
    }
    ]
    12:21:25.884553: UnityDebug: Searching for Unity process 'Android Player'
    12:21:25.888105: Trying to find all Players
    12:21:25.940018: Setting up multicast option: 225.0.0.222: 54997
    12:21:25.940351: Setting up multicast option: 225.0.0.222: 34997
    12:21:25.940525: Setting up multicast option: 225.0.0.222: 57997
    12:21:25.940657: Setting up multicast option: 225.0.0.222: 58997
    12:21:25.940875: Setting up multicast option: 225.0.0.222: 54997
    12:21:25.941044: Setting up multicast option: 225.0.0.222: 34997
    12:21:25.941204: Setting up multicast option: 225.0.0.222: 57997
    12:21:25.941374: Setting up multicast option: 225.0.0.222: 58997
    12:21:25.942224: UnityPlayerConnection is constructed
    12:21:25.944791: Known size of available Players: 0
    12:21:28.952360: New size of available Players: 0
    12:21:28.956093: Error while initializing usbmuxd
    12:21:28.956644: Could not find the correct process name: Android Player
    12:21:28.956757: These are the one that could be found:
    12:21:28.970717: Unity Editor process: Unity on id: 30910
    12:21:28.973756: UnityPlayerConnection is constructed
    12:21:28.973904: Known size of available Players: 0
    12:21:31.979831: New size of available Players: 0
    12:21:31.980242: Unity Editor (Unity) : 30910
    12:21:31.980483: Could not find target name 'Android Player'.
    12:21:31.999718: Command: setBreakpoints: {
    "source": {
    "name": "Console.cs",
    "path": "/Users/byronwright/Projects/viperflypinball2d/Assets/Console/Console.cs"
    },
    "lines": [
    437
    ],
    "breakpoints": [
    {
    "line": 437
    }
    ],
    "sourceModified": false
    }
    12:21:32.027426: Command: setBreakpoints: {
    "source": {
    "name": "Game.cs",
    "path": "/Users/byronwright/Projects/viperflypinball2d/Assets/Scripts/Main/Game.cs"
    },
    "lines": [
    777
    ],
    "breakpoints": [
    {
    "line": 777
    }
    ],
    "sourceModified": false
    }
    12:21:32.028130: Command: disconnect: {
    "restart": false
    }
    12:21:32.029389: UnityDebug: Disconnect: {
    "restart": false
    }
    12:21:32.029629: UnityDebug: Disconnect: VSCodeDebug.Response
    `
     

    Attached Files:

  9. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    245
    @miniwolf_unity : Why isn't debugger 3.x available via VS Code's extensions updates? Most recent version it detects is 2.7.5
     
  10. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    100
    Hey @LilGames, there was unfortunately some additional complications with this version, and I have not been able to provide a stable version of this, due to some deep underlying problems with the debugger libraries that I am using.
    I am in the process of moving much of this code to a newer and better supported framework, but this effort is something that I am spending my 20% time on, as Unity is not officially supporting this effort.
     
  11. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    429
    hey @miniwolf_unity, do you mean your update effort is not a Unity priority, or more broadly that providing a debugger for VSCode is not a Unity priority? I know that your extension is officially unsupported but do you have any idea of how many Unity devs are using VSCode? All except one of our team use it and having working tools (Unity VSCode package, VSCode Unity debugger extension) is obviously really handy. Thanks for your efforts keeping the debugger working!
     
  12. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    100
    @greg-harding it is one of my goals these days to provide my managers with a detailed overview of the usage of the vscode debugger as their chosen IDE. One thing that I am seeing is the 450k installs through the Visual Studio Marketplace.
    The other thing I am seeing is the number of requests I am getting, yes daily.
    The last thing I am seeing is the number of users that find bugs in the newer versions compared to the number of users that finds corner cases in Rider and VS.

    My belief is that we should be putting a lot more effort into this, but this will require Unity to allocate resources for this task, and that I will be granted time to focus on getting the tool in a much better shape.
     
    goncalo-vasconcelos likes this.
  13. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    429
    @miniwolf_unity thanks very much for your reply - much appreciated. Yeah, I usually skim the marketplace stats when upgrading VSCode extensions so it's certainly being installed 'a lot' but no idea of the proportion vs. Visual Studio and Rider etc. It's frustrating that Unity aren't treating it like a first-class citizen but the VSCode team are acting like it is in the wider .Net world.

    For us on macOS the tools and components seem to change every few days and stuff breaks all the time. I'm often chasing github issues and installing pre-release extensions for Omnisharp or backing out versions of VSCode or finding manual installs of the debugger or downloading .Net developer sdk installers to make them all happy again for another week or two. It's quite an effort keeping everything talking... and your efforts with the debugger are very appreciated.

    My current versions: VSCode 1.43.2, Omnisharp 1.21.15, Unity Debugger 2.7.5 and Mono 6.6.0.155 - seem to talk ok after a patchy last few weeks.

    VSCode is useful for us because the setup is light and can be the same across Editor platforms, rather than full Visual Studio on Win vs Visual Studio on macOS and everything those full IDE's require. We have not tried Rider but I expect it would be the same across platforms too.
     
    miniwolf_unity likes this.
  14. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    245
    That's very disappointing and surprising. Please push for more resources. Half a million marketplace installs is substantial.

    Even large organizations like Facebook are using VS Code now (not necessarily with Unity, but the point is the IDE is gaining even more traction). Source: https://www.zdnet.com/article/faceb...code-is-now-our-default-development-platform/

    Or maybe... I don't know, just focus on non-breaking changes?
    https://github.com/Unity-Technologies/vscode-unity-debug/issues/166

    Honestly, MonoDevelop sucks, and VS Community is too bloated. VS Code has been perfect, (until recent breakage).

    PS: Can I request that your changelog list release dates?
     
    AndreiMarian likes this.
  15. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,013
    MonoDevelop has been deprecated for years.

    Xamarin Studio, which it was a fork of, is now named Visual Studio For Mac, because Catbert is in charge of naming things at Microsoft.
     
  16. AndreiMarian

    AndreiMarian

    Joined:
    Jun 9, 2015
    Posts:
    42
    I wonder who still uses msvs... my colleagues all use vs code.
    Come on guys, somebody M$ or Unity, support @miniwolf_unity to release the extension, it's not like it's some common useful extension, it's The Extension.

    EDIT:
    I've read on some forums and expected this custom version to work with static variables (singletons). It doesn't... oh well...
    And please guys don't start a holy war on statics and singletons... it's basic C#, not a C-like language that's been supported by Unity.
     
    Last edited: Jun 8, 2020
  17. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    100
    @AndreiMarian what issue are you facing? Has it been reported on the github issue page?
     
  18. AndreiMarian

    AndreiMarian

    Joined:
    Jun 9, 2015
    Posts:
    42
    The issue is reported here and I've also seen you mentioned here :)

    The issue manifests like this: when debugging and hovering over PlatformManager in PlatformManager.Instance.current it reads "Evaluate request failed (Unknown identifier: PlatformManager)"
     
  19. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    100
    @AndreiMarian I have updated the issue page with a link to a new build. Could you have a go at this?
     
  20. AndreiMarian

    AndreiMarian

    Joined:
    Jun 9, 2015
    Posts:
    42
    Thank you. It still shows the Evaluate request failed error.
     
    Last edited: Jun 10, 2020
  21. miniwolf_unity

    miniwolf_unity

    Unity Technologies

    Joined:
    Apr 10, 2018
    Posts:
    100
    Can you try with the fully qualified name?
    {namespace}.PlatformManager.Instance.current
    and put {namespace} to whatever namespace it lies in?
     
  22. AndreiMarian

    AndreiMarian

    Joined:
    Jun 9, 2015
    Posts:
    42
    With Reo.PlatformManager.Instance.current
    it now says "Evaluate request failed (Unknown identifier: Reo)" where Reo is the namespace.
     
  23. Metastable

    Metastable

    Joined:
    Apr 10, 2013
    Posts:
    44
    It looks like this version is still pointing to the old c# library name
     
  24. AndreiMarian

    AndreiMarian

    Joined:
    Jun 9, 2015
    Posts:
    42
    More info:
    With or without namespace qualifier step-in works fine on PlatformManager.Instance.GoToPlatform().
    Also Instance.current (in PlatformManager.cs script) works as expected, shows proper details.
     
  25. sicklebrick

    sicklebrick

    Joined:
    Apr 8, 2012
    Posts:
    50
    Should I consider this semi abandonware for now and shelf the idea of using VSCode as my daily driver for now?
    I'm loving everything about VSCode, but something like

    Code (CSharp):
    1. [System.Serializable]
    2. class car{ int price = 20; }
    3.  
    4. List<Car> cars = new List<Car<();   // then populate it
    5.  
    6. blah = cars[ i ].price;
    I can hover over 'blah', 'cars' and 'i' fine, but 'price' or the serializable class is a no-go with the "Evaluate request failed" business as usual. (Works in e.g. rider, vs, etc for reference).

    Thanks!
     
    terrehbyte likes this.
  26. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    245
    I can confirm for you that all works normally [for me] with the following versions:

    - C# extension 1.21.18
    - Debugger for Unity 2.7.5
    - Visual Code 1.43.2 (there are updates but I keep clicking "later")
     
  27. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    245
    And now... for whatever reason, debugging does NOT work. All the same versions of software and extensions I listed previously.

    Any news @miniwolf_unity ? Unity is doing an IPO. You should push to get a stable budget for this.
     
  28. AndreiMarian

    AndreiMarian

    Joined:
    Jun 9, 2015
    Posts:
    42
    I realized Visual Code is too young. Using Visual Studio 2019 for the time being.
     
unityunity