dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.87k stars 675 forks source link

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (0x8007000B) #6919

Open dibarbet opened 8 months ago

dibarbet commented 8 months ago

Copied from https://github.com/dotnet/vscode-csharp/issues/6842#issuecomment-1951014724 by @dkflRus

Using dotnet configured on PATH
Dotnet path: /usr/share/dotnet/dotnet
Activating C# standalone...
Starting server at /home/dkfl/.vscode-oss/extensions/ms-dotnettools.csharp-2.17.7/.roslyn/Microsoft.CodeAnalysis.LanguageServer.dll
Server arguments /home/dkfl/.vscode-oss/extensions/ms-dotnettools.csharp-2.17.7/.roslyn/Microsoft.CodeAnalysis.LanguageServer.dll --logLevel Trace --telemetryLevel off --extensionLogDirectory /home/dkfl/.config/Code - OSS/logs/20240218T102340/window1/exthost/ms-dotnettools.csharp
waiting for named pipe information from server...
[stderr] Unhandled exception. [stderr] System.BadImageFormatException: An attempt was made to load a program with an incorrect format.
 (0x8007000B)
[Error - 10:25:01 AM] Microsoft.CodeAnalysis.LanguageServer client: couldn't create connection to server.
Error: Timeout. Named pipe information not received from server.
    at q.<anonymous> (/home/dkfl/.vscode-oss/extensions/ms-dotnettools.csharp-2.17.7/dist/extension.js:2:1291052)
    at Generator.next (<anonymous>)
    at s (/home/dkfl/.vscode-oss/extensions/ms-dotnettools.csharp-2.17.7/dist/extension.js:2:1280530)
dibarbet commented 8 months ago

@dkflRus this is often a sign of a corrupt dotnet installation or extension installation. Can you paste the output of dotnet --info and which dotnet?

I would also try

  1. Completely delete and re-install the C# extension a. Uninstall the extension in vscode b. Open the extensions folder (there should be an 'open extensions folder' command in vscode) c. With the extension uninstalled and vscode closed, delete all the ms-dotnettools.csharp folders in the extension folder d. Re-open vscode and re-install.
  2. Completely delete and re-install dotnet. The instructions vary depending on platform and how it was installed.