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.
See original GitHub issueIssue Description
An error message when OmniSharp initializes on a newly created webapi project.
Steps to Reproduce
Create a webapi project and install OmniSharp
Expected Behavior
To have no error.
Actual Behavior
Error.
Logs
OmniSharp log
Starting OmniSharp server at 1/30/2020, 11:51:34 AM
Target: /home/gabriel/Workspace/careplus-email-api
OmniSharp server started with Mono 5.18.0.
Path: /home/gabriel/.vscode/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/OmniSharp.exe
PID: 24986
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 <27dcabbd1f5d4edeaffe820a1236c676>:0
at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__0 () [0x00006] in <2d02054c9f224f8aa95299738e820ffb>:0
at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <1ed0cdfb5a5d42889b4f5df087ff7bd6>:0
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).
C# log
Environment information
VSCode version: 1.41.1 C# Extension: 1.21.9 OS: Ubuntu 19.10 64 bits
Mono Information
OmniSharp using global mono :5.18.0Dotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.1.101 Commit: b377529961Runtime Environment: OS Name: ubuntu OS Version: 19.10 OS Platform: Linux RID: ubuntu.19.10-x64 Base Path: /usr/share/dotnet/sdk/3.1.101/
Host (useful for support): Version: 3.1.1 Commit: a1388f194c
.NET Core SDKs installed: 3.1.101 [/usr/share/dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.1 [/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.21.9 |
dart-code | Dart-Code | 3.7.1 |
flutter | Dart-Code | 3.7.1 |
vscode-great-icons | emmanuelbeziat | 2.1.47 |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top GitHub Comments
@konradmb Yes!
sudo apt install mono-complete
fixed it for me. Pop!_os 20.04 mono 6.8.0.105@jpietrzyk Basically, OmniSharp can’t load required assemblies. You can try either installing
mono-complete
package or setting"omnisharp.useGlobalMono": "never"
in VSCode settings.Installing
mono-complete
is a better way, because you’ll get more libraries, newer version etc.I wonder why loading internal mono isn’t the default, especially when OmniSharps ships it inside the extension, and Ubuntu has a stripped down version of mono by default. But it could lead to even more problems…