Omnisharp-vscode: Error: OmniSharp fails to load

Created on 8 Dec 2018  路  10Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:

.NET Core SDK (reflecting any global.json):
 Version:   2.1.400
 Commit:    8642e60a0f

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.400/

Host (useful for support):
  Version: 2.1.2
  Commit:  811c3ce6c0

.NET Core SDKs installed:
  2.1.3 [/usr/local/share/dotnet/sdk]
  2.1.4 [/usr/local/share/dotnet/sdk]
  2.1.200 [/usr/local/share/dotnet/sdk]
  2.1.300 [/usr/local/share/dotnet/sdk]
  2.1.301 [/usr/local/share/dotnet/sdk]
  2.1.400 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

VS Code version: 1.29.1
C# Extension version: 1.17.1

Steps to reproduce

Open C# project

Expected behavior

OmniSharp server starts up normally.

Actual behavior

Omnisharp fails during startup

Starting OmniSharp server at 12/8/2018, 3:25:30 PM

OmniSharp server started with Mono 5.16.0.
    Path: /Users/alekseyusatov/.vscode/extensions/ms-vscode.csharp-1.17.1/.omnisharp/1.32.8/omnisharp/OmniSharp.exe
    PID: 45088

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.14.1 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
Failed to launch 'mono' with args, '--version'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/Users/alekseyusatov/.vscode/extensions/ms-vscode.csharp-1.17.1/.omnisharp/1.32.8/omnisharp/msbuild/15.0/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/Users/alekseyusatov/.vscode/extensions/ms-vscode.csharp-1.17.1/.omnisharp/1.32.8/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "/Users/alekseyusatov/.vscode/extensions/ms-vscode.csharp-1.17.1/.omnisharp/1.32.8/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /Library/Frameworks/Mono.framework/Versions/5.16.0/lib/mono/xbuild
            BypassFrameworkInstallChecks = true
            CscToolPath = /Users/alekseyusatov/.vscode/extensions/ms-vscode.csharp-1.17.1/.omnisharp/1.32.8/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /Users/alekseyusatov/.vscode/extensions/ms-vscode.csharp-1.17.1/.omnisharp/1.32.8/omnisharp/msbuild/15.0/Bin
            TargetFrameworkRootPath = /Library/Frameworks/Mono.framework/Versions/5.16.0/lib/mono/xbuild-frameworks
System.TypeLoadException: Could not load type of field 'OmniSharp.MSBuild.ProjectManager:_queue' (11) due to: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
  at (wrapper managed-to-native) System.RuntimeType.GetPropertiesByName_native(System.RuntimeType,intptr,System.Reflection.BindingFlags,bool)
  at System.RuntimeType.GetPropertiesByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.Boolean icase, System.RuntimeType reflectedType) [0x0001b] in <98fac219bd4e453693d76fda7bd96ab0>:0 
  at System.RuntimeType.GetPropertyCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Type[] types, System.Boolean allowPrefixLookup) [0x00010] in <98fac219bd4e453693d76fda7bd96ab0>:0 
  at System.RuntimeType.GetProperties (System.Reflection.BindingFlags bindingAttr) [0x00000] in <98fac219bd4e453693d76fda7bd96ab0>:0 
  at System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties (System.Type type) [0x00006] in <98fac219bd4e453693d76fda7bd96ab0>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverPropertyExports>d__7.MoveNext () [0x00030] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverExports>d__5.MoveNext () [0x000dc] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart (System.Reflection.TypeInfo type, System.Composition.TypedParts.Discovery.DiscoveredPart& part) [0x00061] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (System.Collections.Generic.IEnumerable`1[T] types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00037] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00042] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at OmniSharp.CompositionHostBuilder.Build () [0x001f6] in <b0a7a1010bfe4b01af0da4ccbeac0c7a>:0 
  at OmniSharp.Stdio.Host..ctor (System.IO.TextReader input, OmniSharp.Stdio.Services.ISharedTextWriter writer, OmniSharp.IOmniSharpEnvironment environment, System.IServiceProvider serviceProvider, OmniSharp.CompositionHostBuilder compositionHostBuilder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Threading.CancellationTokenSource cancellationTokenSource) [0x00057] in <5e8e2ad26ef5465098aa876c7f625e58>:0 
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.<Main>b__1 () [0x00138] in <7c70c184a3894fbab0d699bc9b4ceac6>:0 
  at OmniSharp.CommandLineApplication+<>c__DisplayClass11_0.<OnExecute>b__0 () [0x0000b] in <b0a7a1010bfe4b01af0da4ccbeac0c7a>:0 
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00039] in <344a1e8cd6594b17b1e01f8df6ae8827>:0 
  at OmniSharp.CommandLineApplication.Execute (System.Collections.Generic.IEnumerable`1[T] args) [0x00042] in <b0a7a1010bfe4b01af0da4ccbeac0c7a>:0 
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__0 () [0x00028] in <7c70c184a3894fbab0d699bc9b4ceac6>:0 
  at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <b0a7a1010bfe4b01af0da4ccbeac0c7a>:0 
Resolved-Configuration Issue

Most helpful comment

In my case the problem was solved by installing the msbuild package.

All 10 comments

@tuscen Can you confirm that the file System.Threading.Tasks.Dataflow.dll is next to omnisharp.exe under /Users/alekseyusatov/.vscode/extensions/ms-vscode.csharp-1.17.1/.omnisharp/1.32.8/omnisharp? IF it isn't you may need to delete /Users/alekseyusatov/.vscode/extensions/ms-vscode.csharp-1.17.1/.omnisharp and /Users/alekseyusatov/.vscode/extensions/ms-vscode.csharp-1.17.1/install.lock and let the extension download omnisharp again. (Cc @akshita31 )

@rchande The file is there.

I've also tried to remove everything related to VS Code and OmniSharp and make a clean install. The problem is still there.

I have the same issue

Zestaw .NET Core SDK (odzwierciedlenie dowolnego pliku global.json):
 Version:   2.2.100
 Commit:    51868761f2

艢rodowisko uruchomieniowe:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.2.100/

Host (useful for support):
  Version: 2.2.0
  Commit:  1249f08fed

.NET Core SDKs installed:
  2.1.4 [/usr/local/share/dotnet/sdk]
  2.1.300 [/usr/local/share/dotnet/sdk]
  2.1.301 [/usr/local/share/dotnet/sdk]
  2.1.302 [/usr/local/share/dotnet/sdk]
  2.2.100 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Mono 15.0 - "/Library/Frameworks/Mono.framework/Versions/5.16.0/lib/mono/msbuild/15.0/bin"
            CscToolPath = /Users/witek/.vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
System.TypeLoadException: Could not load type of field 'OmniSharp.MSBuild.ProjectManager:_queue' (9) due to: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
  at (wrapper managed-to-native) System.RuntimeType.GetPropertiesByName_native(System.RuntimeType,intptr,System.Reflection.BindingFlags,bool)
  at System.RuntimeType.GetPropertiesByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.Boolean icase, System.RuntimeType reflectedType) [0x0001b] in <98fac219bd4e453693d76fda7bd96ab0>:0 
  at System.RuntimeType.GetPropertyCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Type[] types, System.Boolean allowPrefixLookup) [0x00010] in <98fac219bd4e453693d76fda7bd96ab0>:0 
  at System.RuntimeType.GetProperties (System.Reflection.BindingFlags bindingAttr) [0x00000] in <98fac219bd4e453693d76fda7bd96ab0>:0 
  at System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties (System.Type type) [0x00006] in <98fac219bd4e453693d76fda7bd96ab0>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverPropertyExports>d__7.MoveNext () [0x00030] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverExports>d__5.MoveNext () [0x000dc] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart (System.Reflection.TypeInfo type, System.Composition.TypedParts.Discovery.DiscoveredPart& part) [0x00061] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (System.Collections.Generic.IEnumerable`1[T] types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00037] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00042] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at OmniSharp.CompositionHostBuilder.Build () [0x00191] in <e53c2b752e604319bef1c55a5946377a>:0 
  at OmniSharp.Stdio.Host..ctor (System.IO.TextReader input, OmniSharp.Stdio.Services.ISharedTextWriter writer, OmniSharp.IOmniSharpEnvironment environment, Microsoft.Extensions.Configuration.IConfiguration configuration, System.IServiceProvider serviceProvider, OmniSharp.CompositionHostBuilder compositionHostBuilder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Threading.CancellationTokenSource cancellationTokenSource) [0x0007e] in <2b6261ffe5a64325b4ca31d51e1800ce>:0 
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__1 () [0x00116] in <5fbf8e833fb94e3d93e7569caf9e7b2e>:0 
  at OmniSharp.CommandLineApplication+<>c__DisplayClass11_0.<OnExecute>b__0 () [0x0000b] in <e53c2b752e604319bef1c55a5946377a>:0 
  at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x0035b] in <e56ebbc3ed87488b8e26736bbadaa5d3>:0 
  at OmniSharp.CommandLineApplication.Execute (System.Collections.Generic.IEnumerable`1[T] args) [0x00042] in <e53c2b752e604319bef1c55a5946377a>:0 
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.<Main>b__0 () [0x00028] in <5fbf8e833fb94e3d93e7569caf9e7b2e>:0 
  at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <e53c2b752e604319bef1c55a5946377a>:0 
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).

Same issue running Visual Studio Code on Mac

Same issue running Visual Studio Code on Manjaro (Arch) Linux.

@tuscen I took a closer look at your log and it looks like something is wrong with your mono installation:

[info]: OmniSharp.Stdio.Host
Starting OmniSharp on MacOS 10.14.1 (x64)
DotNetPath set to dotnet
Failed to launch 'mono' with args, '--version'

You'll need to fix your installation of mono or you can set the option omnisharp.useGlobalMono to use the built in one.

@tuscen I'm going to close this issue as I believe we understand the problem. @martinesmann @djkiwe please file separate issues and include

  • output of dotnet --info
  • output of mono --version
  • complete omnisharp log

Yes, useGlobalMono set to never solves the problem.

I don't know what's the exact problem with my global mono. I don't use it myself for anything but I can run it using terminal. I've tried wiping it out and reinstall the latest one. Unfortunately, the problem hasn't gone if I set useGlobalMono for auto or always.

In my case the problem was solved by installing the msbuild package.

@tuscen Your solution worked for me thanks man

Was this page helpful?
0 / 5 - 0 ratings