dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.83k stars 654 forks source link

Omnisharp not working from TypeLoadException #3131

Open talitek opened 5 years ago

talitek commented 5 years ago

Issue Description

Every time I attempt to write a C# program, IntelliSense is not working properly. I see no error messages from my code, and receive no suggestions. After doing a bit of Googling I think it may be that the OmniSharp version installed relies on an outdated version of .NET, though I may be completely wrong with that. Please help!

Steps to Reproduce

Write any code in C# whatsoever.

Expected Behavior

Intellisense works.

Actual Behavior

It doesn't.

Logs

OmniSharp log

Starting OmniSharp server at 21/06/2019, 15:46:00 Target: /home/andrew/Repos/Unity2D/Intro_Setup/Hello World/Hello World.sln OmniSharp server started with Mono 5.18.0. Path: /home/andrew/.vscode/extensions/ms-vscode.csharp-1.20.0/.omnisharp/1.32.20/omnisharp/OmniSharp.exe PID: 1449 System.TypeLoadException: Could not load type of field 'McMaster.Extensions.CommandLineUtils.CommandLineApplication:_validationErrorHandler' (36) due to: Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. at OmniSharp.Stdio.StdioCommandLineApplication..ctor () [0x00000] in :0 at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.
b__0 () [0x00006] in <8c53cc66f1ca4f63a09ec8173bd47c77>:0 at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in :0

C# log

N/A

Environment information

VSCode version: 1.35.1 C# Extension: 1.20.0

Mono Information OmniSharp using global mono :5.18.0
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 2.2.300 Commit: 73efd5bd87 Runtime Environment: OS Name: debian OS Version: 10 OS Platform: Linux RID: linux-x64 Base Path: /usr/share/dotnet/sdk/2.2.300/ Host (useful for support): Version: 2.2.5 Commit: 0a3c9209c0 .NET Core SDKs installed: 2.2.300 [/usr/share/dotnet/sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.2.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |csharp|ms-vscode|1.20.0| |csharpextensions|jchannon|1.3.0| |python|ms-python|2019.5.18875| |unity-tools|Tobiah|1.1.1| |vscodeintellicode|VisualStudioExptTeam|1.1.7|;
filipw commented 4 years ago

Please upgrade Mono to 6.4.0 (latest) and C# extension to 1.21.4 (latest). This should now be resolved.