question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

Issue 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

I don't know how to do it

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.0
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.101 Commit: b377529961

Runtime 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:open
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

16reactions
Semicolon192commented, Jun 16, 2020

@konradmb Yes! sudo apt install mono-complete fixed it for me. Pop!_os 20.04 mono 6.8.0.105

11reactions
konradmbcommented, Apr 30, 2020

@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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found