dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.84k stars 666 forks source link

[BUG] Failed to initialize AssemblyLoadContext Microsoft.VisualStudio.LanguageServices.DevKit #6154

Open arkalyanms opened 1 year ago

arkalyanms commented 1 year ago

From vscode-dotnettools created by m4ss1m0g: microsoft/vscode-dotnettools#301

Describe the Issue

Using scoop (a package manager) for installing vscode on subsequential update when starting vscode broke the extension. On C# output the message is:

fail: Microsoft.CodeAnalysis.LanguageServer.ExportProviderBuilder[0] Failed to initialize AssemblyLoadContext Microsoft.VisualStudio.LanguageServices.DevKit System.IO.DirectoryNotFoundException: Could not find a part of the path 'c:\Users\user1\scoop\apps\vscode\1.80.1\data\extensions\ms-dotnettools.csdevkit-0.2.100-win32-x64\components\roslyn-visualstudio-languageservices-devkit\node_modules\@microsoft\visualstudio-languageservices-devkit'.

This error raises when I update the vscode from 1.80.1 to 1.80.2

Steps To Reproduce

  1. Install scoop
  2. Install vscode with scoop scoop install vscode
  3. Install the C# Dev KIt extension
  4. Update vscode with scoop
  5. Start vscode
  6. On C# output there are the error above

Expected Behavior

When updating vscode the extensions find the new path.

Notes

I found the path on C:\Users\user1\scoop\persist\vscode\data\extensions\ms-dotnettools.csdevkit-0.2.100-win32-x64\cache directory.

Removing the folder and reload the vscode fix the error.

Environment Information

zhangchaoza commented 10 months ago

I had the same question, thanks to @arkalyanms's notes, I wrote a pwsh script to clear it manually after vsc upgrade.

rm -Recurse "$HOME\scoop\persist\vscode\data\extensions\ms-dotnettools.csdevkit-*\cache"

Is there a plan to fix this?