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

PSA: If your VS Code C# extension stopped working...

Discussion in 'External Tools' started by Incode, Mar 5, 2020.

  1. Incode

    Incode

    Joined:
    Apr 5, 2015
    Posts:
    63
    If you opened VS Code today and your Unity Debugger wasn't working or it was having issues detecting Assemblies, check if your C# extension updated to 1.21.13. They renamed the package, which was a breaking change.

    You can find old package versions here: https://github.com/OmniSharp/omnisharp-vscode/releases

    Download an older file, then in your extensions panel click the three dots in the upper right corner and select "install from VSIX...". Install whichever older version you downloaded (1.21.12 and older should work.)
    While you're at it you might want to disable auto update extensions in your VS Code settings.

    While you're at it you might want to disable auto update extensions in your VS Code settings.

    2020-04-02 Edit
    I am now able to work successfully using the latest versions of all software. I am using:
    VS Code - 1.43.2
    C# extension (omnisharp) - 1.21.16
    Debugger for Unity extension - 2.7.5.
    VS Code Unity Package - 1.2.0.

    2020-10-19 Edit
    The latest Omnisarp (1.23.4) is broken today. My current working settings are:
    VS Code 1.50.1
    C# extension (omnisharp) - 1.23.2
    Debugger for Unity - 2.7.5
    VS Code Unity Package - 1.2.2
     
    Last edited: Oct 20, 2020
    hg001, timmccune, SINePrime and 27 others like this.
  2. BatslyAdams

    BatslyAdams

    Joined:
    Feb 27, 2015
    Posts:
    1
    thanks so much! i just had the same experience, glad to know it wasn't just me
     
  3. LuiBroDood

    LuiBroDood

    Joined:
    Mar 13, 2019
    Posts:
    16
    thanks was annoying me
     
  4. Yiliu

    Yiliu

    Joined:
    Oct 31, 2016
    Posts:
    1
    Just wasted half a day uninstalling and reinstalling my whole workflow. You saved me the other half of my day. Thank you.
     
  5. Sazem

    Sazem

    Joined:
    Oct 16, 2011
    Posts:
    48
    Helped me too! Thank you for this. On a tight deadline and ofcourse this kind of problems with VsCode starts appearing.. Finally took me only 30mins to fix it with those advices!! (would have been less but wanted to download something after the reset)
     
  6. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    521
    Thank you hero.
     
  7. huhwhozat

    huhwhozat

    Joined:
    Feb 6, 2013
    Posts:
    2
    Thanks for this! I'm still having an issue however; installing v1.21.12 has got my C# extension working again, but now vscode is failing to find a whole lot of assemblies. Omnisharp log is full of entries like:

    Unable to resolve assembly 'c:\Users\USERNAME\Unity Projects\PROJECT\Temp\bin\Debug\UnityEngine.TestRunner.dll'

    It is able to resolve some assemblies however, including Unity.Mathematics and a couple others.

    Any ideas?
     
  8. Incode

    Incode

    Joined:
    Apr 5, 2015
    Posts:
    63
    If you are on version 1.1.4 of the VS Code package, downgrade to 1.1.3, close Unity and VS Code and then reopen. There is a separate known issue in that package that is causing errors.
     
    Radivarig likes this.
  9. huhwhozat

    huhwhozat

    Joined:
    Feb 6, 2013
    Posts:
    2
    Thanks so much! I have found threads for the other issue now that I know what to look for. I forgot I updated packages too.
     
  10. bennykok_

    bennykok_

    Joined:
    Dec 22, 2016
    Posts:
    18
    thanksssss so much for the info, saved my life.
     
  11. marcospgp

    marcospgp

    Joined:
    Jun 11, 2018
    Posts:
    9
    What do you mean VSCode package? The person you quoted said they installed version 1.21.12 of the extension, is that what you're referring to? What version 1.1.4 are you referring to?
     
  12. Incode

    Incode

    Joined:
    Apr 5, 2015
    Posts:
    63
    The VS Code Integration in the Unity Package manager.
     
    Gertbo likes this.
  13. spiritworld

    spiritworld

    Joined:
    Nov 26, 2014
    Posts:
    10
    Basic day in my Unity development "why isn't this tool working? Yesterday it was fine."

    Also, thanks, saved the day.
     
    EvOne likes this.
  14. nmbileg

    nmbileg

    Joined:
    Sep 29, 2017
    Posts:
    21
    Oh boy thanks! This was hella annoying!
     
  15. GAS

    GAS

    Joined:
    Nov 12, 2013
    Posts:
    3
  16. Peter5897

    Peter5897

    Joined:
    Jan 4, 2017
    Posts:
    20
    Incode likes this.
  17. latsoft

    latsoft

    Joined:
    Jan 29, 2020
    Posts:
    2
    감사합니다.
    이것이 정답입니다.

    Thank you.
    This is the correct answer.
     
  18. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    206
    Is there a real Unity + VS Code solution planned for this?
     
    KokodokoGames likes this.
  19. Peter5897

    Peter5897

    Joined:
    Jan 4, 2017
    Posts:
    20
    vscode-unity-debug was updated today to point at the new C# dependency so you should be able to get the latest package.

    I'm not sure what you mean? Are you asking for an "officially supported" extension?
     
    Incode likes this.
  20. Incode

    Incode

    Joined:
    Apr 5, 2015
    Posts:
    63
    I just tried updating to the latest debugger, and C#/Omnisharp 1.21.14 and autocomplete and suggestions were still broken. Not sure if others are having this issue, but I'm reverting to my workaround for the time being.
     
    AdityaMGametion likes this.
  21. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    206
    Just wondering when/if whoever "officially" owns the vscode-unity-debug package was going to correct the dependency... :). It seems they tried and failed... based on the comment above from @Incode?

    Is there an ETA when this is truly going to be fixed?

    Perhaps a relevant aside: I've found VS code has become extremely slow at updating my references, since this package has been broken. It now takes about 20 mins after first launch of VS until I can things like "Find All References".
     
  22. Incode

    Incode

    Joined:
    Apr 5, 2015
    Posts:
    63
    @Domas_L Could you look into the Unity Debugger for VS Code being broken? Is my work around still needed in this case, or do we need to fully clean out the .csproj and .sln files after updating the extension or something?
     
  23. Peter5897

    Peter5897

    Joined:
    Jan 4, 2017
    Posts:
    20
    Edit: I'm a dirty liar and everything is broken and sad still. For some reason this worked with an older project but creating a new project caused autocomplete to no longer work.

    I updated to the latest unity extension (2.7.3) and it seems to be working for me, I have the debugger working as well as autocomplete and suggestions. Remember to update your C# plugin as well, I'm on 1.21.14. For a while I was on 1.21.12 and I had to manually uninstall that.

    Also vs code 1.43.0
     
    Last edited: Mar 16, 2020
  24. Incode

    Incode

    Joined:
    Apr 5, 2015
    Posts:
    63
    What package version do you have installed in the package manager?
     
  25. herb_nice

    herb_nice

    Joined:
    May 4, 2017
    Posts:
    168
    hmm, after visual studio code updated itself to 1.43.0, i also can no longer work with my unity project correctly. i tried both 1.21.12 and 12.21.14 and still visual studio code can no longer understand unity classes, or autocomplete, or go to definitions.

    this message is in the c# output window of visual studio code when it opens:

    Failed to spawn 'dotnet --info'

    yay, visual studio code F***ed itself when it updated itself to 1.43.0. i will try reinstalling an older version- and disable auto updates if it does work.
     
  26. herb_nice

    herb_nice

    Joined:
    May 4, 2017
    Posts:
    168
    a combination of rolling back visual studio code to 1.42.1 and c# to 1.21.12 got my autocomplete and go to definition functionality working again. autoupdates are now disabled for everything. F*** that S***, it just causes headaches.
     
    EvOne likes this.
  27. Peter5897

    Peter5897

    Joined:
    Jan 4, 2017
    Posts:
    20
    Edit: I'm a dirty liar and everything is broken and sad still. For some reason this worked with an older project but creating a new project caused autocomplete to no longer work.

    Sorry I missed this, I assume you mean the visual studio code package manager?

    upload_2020-3-15_15-7-37.png

    Not sure what I'm doing differently but I have autocomplete working.

    upload_2020-3-15_15-8-56.png

    Oh... I am on Visual Studio Code Editor 1.13 in unity because 1.1.4 had problems described here: https://forum.unity.com/threads/vis...the-referenced-project-does-not-exist.806628/

    upload_2020-3-15_15-10-25.png
     
    Last edited: Mar 16, 2020
    cjonasw likes this.
  28. Incode

    Incode

    Joined:
    Apr 5, 2015
    Posts:
    63
    Yeah, i thought maybe it had something to do with the VS Code Editor and that you had 1.20 installed, I tried updating to that, but still no luck. Not sure what the problem is.
     
  29. chaseholton

    chaseholton

    Joined:
    Dec 17, 2012
    Posts:
    74
    This has been driving me crazy. So glad for this PSA. It seems that most IDE's right now aren't jiving with my project nowadays. It's super weird. Over a year and a half in production and all the sudden. Hope this fixes it!
     
  30. Domas_L

    Domas_L

    Unity Technologies

    Joined:
    Nov 27, 2018
    Posts:
    111
    I couldn't find any active cases about this issue - could you please fill a bug report with repro steps and a minimal repro project and send it to us?
     
  31. SoxwareInteractive

    SoxwareInteractive

    Joined:
    Jan 31, 2015
    Posts:
    450
    I'm having the exact same issue. I can hear my laptop's fan spinning up like crazy for at least 20 mins until I have (very slow) access to intelli sense/go to definition etc. Has rolling back to the V1.21.12 C# extension improved your situation?
     
  32. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    206
    @SoxwareInteractive I'm on 1.21.12 ... references, go to, etc... all extremely slow to populate. Once populated it seems to work fine. Overall very frustrating that our tools are not working.
     
    Last edited: Mar 16, 2020
    goncalo-vasconcelos likes this.
  33. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    206
    Thanks for jumping in here, are you saying the reference issue doesn't break everyone? How is that possible?
     
    Last edited: Mar 17, 2020
    goncalo-vasconcelos likes this.
  34. Peter5897

    Peter5897

    Joined:
    Jan 4, 2017
    Posts:
    20
    I started a new project and started running in to the same issues again. Rolling back to C# version 1.21.12 and Unity debugger 2.7.2 of course fixed it. I'm going to go back to edit my posts to say that it's still broken, not sure why it worked with my previous project though... I'm guessing there's something cached that's allowing it to work.

    A bunch of coworkers are reporting that the latest C# extension completely locks up vs code when attempting to auto complete text. What fun!
     
  35. Domas_L

    Domas_L

    Unity Technologies

    Joined:
    Nov 27, 2018
    Posts:
    111
  36. swilliams44

    swilliams44

    Joined:
    Mar 11, 2019
    Posts:
    1
    ETGgames and v2-Ton-Studios like this.
  37. Peter5897

    Peter5897

    Joined:
    Jan 4, 2017
    Posts:
    20
    ETGgames, yuta1985 and v2-Ton-Studios like this.
  38. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    376
    After the fix it works for a while and then it stops working... Not sure what is causing this but I see that the plugin "Debugger for Unity" requires the latest version of the plugin and loads it. I end up with two versions installed.
     
  39. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    206
    So it's not a fix :|.

    @Domas_L Can you help us out here? TIA!
     
    ETGgames likes this.
  40. Incode

    Incode

    Joined:
    Apr 5, 2015
    Posts:
    63
    Others are reporting that this may be fixed with the latest VS Code extensions Unity Debugger (2.7.5) and C# (1.21.15 which is currently pre-release). I'll update my original post once the extension is officially released and I can confirm that it's fixed.

    If you want the pre-release .VSIX you can get it here: https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.21.15
     
  41. wedge_one

    wedge_one

    Joined:
    Mar 13, 2017
    Posts:
    2
    Couldn't make it work with 1.21.12 and Unity Debugger 2.7.5, because the Debugger always uses the latest version of C# on top of other versions.

    What I did is, updated the VSCode Editor version on Unity Package Manager to 1.2.0 (it's a preview version, the lastest verified is 1.1.4) and got everything working with C# 1.21.14 and Debugger 2.7.5. I hope it helps.
     
    schnauzerfan likes this.
  42. Peter5897

    Peter5897

    Joined:
    Jan 4, 2017
    Posts:
    20
    That's because Unity Debugger 2.7.5 has a dependency on the renamed C# package so it can't work with 1.21.12 since it has the original name. You need to be using Unity Debugger 2.7.2 to work with 1.21.12 but if it's working for you then then rolling back doesn't make much sense. I've still heard reports from people saying the latest C# extension has trouble with autocomplete and go-to symbol.

    Edit: I guess people are reporting that 1.12.15 fixes the performance issues: https://github.com/OmniSharp/omnisharp-vscode/issues/3660
     
  43. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    206
    From what I can see this still does not work correctly.

    Here's where I'm at:

    Windows 10
    VS Code 1.43.1 (user setup)
    C# 1.21.15
    Debugger for Unity 2.7.5

    After installing C# 1.21.15, 1.21.12 stayed installed. I manually uninstalled it. Then did a full system restart.

    ////

    After updating and restarting...

    Go to reference, find references and loading reference time and overall performance is fine.

    However, debugging still doesn't work correctly.

    EDIT 1: Most breakpoints do not get hit, when a breakpoint does get hit it forces Unity to Break / Pause.

    EDIT 2: Cannot "play" with the Debugger enabled. Editor gets locked in "start play" mode.

    SOME breakpoints will get hit, others are missed -- doesn't seem to be any logic to it.

    IF HIT when trying to evaluate locals I get the "Evaluate request failed ({_reason})" popup in the bottom right corner. When I hover over a local with my cursor I do get the correct info as a popup. I can also "step into" functions.

    Anyone else seeing these issues?
     
    Last edited: Mar 24, 2020
    swilliams44 and ETGgames like this.
  44. ETGgames

    ETGgames

    Joined:
    Jul 10, 2015
    Posts:
    40
    Basically getting the exact same problem! I hope they hurry up and fix it, it's really hindering my development... (Am on mac btw)
     
    swilliams44 and v2-Ton-Studios like this.
  45. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    206
    Friendly bump to get some Unity insight here. Is a fix in the works? TIA!
     
    swilliams44 and ETGgames like this.
  46. AidanofVT

    AidanofVT

    Joined:
    Nov 10, 2019
    Posts:
    63
    I think I'm having the exact same issue. Switching to an older version of the unity debugger made it seem slightly less broken (the step-over and step-into buttons are no longer greyed out, and I no longer get a bunch of "Loaded assembly: ..." messages upon startup). It's still not usable though. There are no variables shown, and I can't see what line it's on. Also VS Code is not remembering the workspace when it's closed. Does anyone know whether this has officially been reported as an issue?
     
    ETGgames likes this.
  47. herb_nice

    herb_nice

    Joined:
    May 4, 2017
    Posts:
    168
    this is not the first time a visual studio code auto update has wrecked everything for me. i'd recommend going back to versions of stuff that work and turning off auto updates. for me that was visual studio code back to 1.42.1 and c# to 1.21.12
     
  48. Incode

    Incode

    Joined:
    Apr 5, 2015
    Posts:
    63
    Are you still in a fully broken state after trying the steps from my oringinal approach, or are you waiting on an official fix? You should be able to use VS Code applying the steps I outlined, and ensuring you're on the VS Code package 1.1.3 or 1.2.0 (in Unity's package manager).
     
  49. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    206
    Waiting for an official fix. Huge thanks to you for finding a work around, but this is something that should be officially addressed by Unity and VS Code.

    I realise the world has a lot more important stuff going on right now, and if that is the reason for the delay, no problem.

    But if it isn't. If this is just being ignored, then I feel that is unfair. I pay for Unity, as many do, and VS Code is an officially supported / recommended tool. It shouldn't be up to the community to fix issues with it. Nor should we have to exist in a state when we have to put off VS Code / C# / etc updates. I don't think it's too much to ask for someone from Unity to drop in here and let us know this will be corrected.
     
    ETGgames likes this.
  50. AidanofVT

    AidanofVT

    Joined:
    Nov 10, 2019
    Posts:
    63
    That fixed it for me, thanks.
     
    herb_nice and ETGgames like this.
unityunity