Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omnisharp-vscode version 1.24.3 does not load on debian (possibly other OS'es) #5147

Closed
ManfredLange opened this issue Apr 2, 2022 · 11 comments

Comments

@ManfredLange
Copy link

ManfredLange commented Apr 2, 2022

Issue Description

Version 1.24.3 of the extension fails to load, throwing an TypeLoadException with message

Could not load type of field 'Roslynator.Host.Mef.MefHostServices:_compositionContext' (2) due to: Could not load file or assembly 'System.Composition.Runtime, Version=1.0.31.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,System.RuntimeType/MemberListType)
... more stack frames in OmniSharp log below

Steps to Reproduce

Use docker base image mcr.microsoft.com/dotnet/sdk:6.0.201 for the dev container then specify the extension in devcontainer.json for the dev container. After VS Code has connected to the dev container it attempts to install the extension which fails with a TypeLoadException.

Using the docker base image with the .NET SDK ensures that no other .NET SDKs or .NET runtimes are installed in the environment. For investigation and/or testing, I believe this could be critical.

Expected Behavior

Version 1.24.3 of the extension loads without exception

Actual Behavior

Version 1.24.3 throws TypeLoadException when being installed/loaded by VS Code. All functionality is broken, in particular code actions.

Logs

OmniSharp log

Starting OmniSharp server at 4/2/2022, 9:12:28 PM Target: /src/Backend.sln

OmniSharp server started.
Path: /home/dev/.vscode-server/extensions/ms-dotnettools.csharp-1.24.3-linux-x64/.omnisharp/1.38.2/run
PID: 1700

Starting OmniSharp on debian 11.0 (x64)
info: OmniSharp.Services.DotNetCliService
Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
info: OmniSharp.Services.DotNetCliService
Using the 'dotnet' on the PATH.
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 17.1.1 - "/home/dev/.vscode-server/extensions/ms-dotnettools.csharp-1.24.3-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild/Current/Bin"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/home/dev/.vscode-server/extensions/ms-dotnettools.csharp-1.24.3-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 17.1.1 - "/home/dev/.vscode-server/extensions/ms-dotnettools.csharp-1.24.3-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /home/dev/.vscode-server/extensions/ms-dotnettools.csharp-1.24.3-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild/Current/Bin
CscToolPath = /home/dev/.vscode-server/extensions/ms-dotnettools.csharp-1.24.3-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /home/dev/.vscode-server/extensions/ms-dotnettools.csharp-1.24.3-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild
System.TypeLoadException: Could not load type of field 'Roslynator.Host.Mef.MefHostServices:_compositionContext' (2) due to: Could not load file or assembly 'System.Composition.Runtime, Version=1.0.31.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,System.RuntimeType/MemberListType)
at System.RuntimeType.GetPropertiesByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.RuntimeType+MemberListType listType, System.RuntimeType reflectedType) [0x0001b] in <533173d24dae460899d2b10975534bb0>:0
at System.RuntimeType.GetPropertyCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Type[] types, System.Boolean allowPrefixLookup) [0x00010] in <533173d24dae460899d2b10975534bb0>:0
at System.RuntimeType.GetProperties (System.Reflection.BindingFlags bindingAttr) [0x00000] in <533173d24dae460899d2b10975534bb0>:0
at System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties (System.Type type) [0x00014] in <533173d24dae460899d2b10975534bb0>:0
at System.Composition.TypedParts.Discovery.TypeInspector+d__7.MoveNext () [0x00037] in <2d4bd81b7fea479cb0a52f844b6edf97>:0
at System.Composition.TypedParts.Discovery.TypeInspector+d__5.MoveNext () [0x000db] in <2d4bd81b7fea479cb0a52f844b6edf97>:0
at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart (System.Reflection.TypeInfo type, System.Composition.TypedParts.Discovery.DiscoveredPart& part) [0x00061] in <2d4bd81b7fea479cb0a52f844b6edf97>:0
at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (System.Collections.Generic.IEnumerable1[T] types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00037] in <2d4bd81b7fea479cb0a52f844b6edf97>:0 at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00042] in <2d4bd81b7fea479cb0a52f844b6edf97>:0 at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create (System.Collections.Generic.IEnumerable1[T] assemblies) [0x00031] in :0
at OmniSharp.HostServicesAggregator.CreateHostServices () [0x00000] in <407751de6f434a52aa536ffcf396059d>:0
at OmniSharp.OmniSharpWorkspace..ctor (OmniSharp.HostServicesAggregator aggregator, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, OmniSharp.FileWatching.IFileSystemWatcher fileSystemWatcher) [0x00046] in <407751de6f434a52aa536ffcf396059d>:0
at (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,System.Composition.Hosting.Core.LifetimeContext,System.Composition.Hosting.Core.CompositionOperation)
at System.Composition.TypedParts.ActivationFeatures.DisposalFeature+<>c__DisplayClass0_0.b__0 (System.Composition.Hosting.Core.LifetimeContext c, System.Composition.Hosting.Core.CompositionOperation o) [0x00000] in <2d4bd81b7fea479cb0a52f844b6edf97>:0
at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate (System.Int32 sharingId, System.Composition.Hosting.Core.CompositionOperation operation, System.Composition.Hosting.Core.CompositeActivator creator) [0x000a8] in :0
at System.Composition.TypedParts.ActivationFeatures.LifetimeFeature+<>c__DisplayClass1_0.b__0 (System.Composition.Hosting.Core.LifetimeContext c, System.Composition.Hosting.Core.CompositionOperation o) [0x00011] in <2d4bd81b7fea479cb0a52f844b6edf97>:0
at System.Composition.Hosting.Core.CompositionOperation.Run (System.Composition.Hosting.Core.LifetimeContext outermostLifetimeContext, System.Composition.Hosting.Core.CompositeActivator compositionRootActivator) [0x00022] in :0
at System.Composition.Hosting.Core.LifetimeContext.TryGetExport (System.Composition.Hosting.Core.CompositionContract contract, System.Object& export) [0x0001d] in :0
at System.Composition.Hosting.CompositionHost.TryGetExport (System.Composition.Hosting.Core.CompositionContract contract, System.Object& export) [0x00000] in :0
at System.Composition.CompositionContext.GetExport (System.Composition.Hosting.Core.CompositionContract contract) [0x00000] in <9222e906419e4f47bc57ced5ad91678c>:0
at System.Composition.CompositionContext.GetExport (System.Type exportType, System.String contractName) [0x00008] in <9222e906419e4f47bc57ced5ad91678c>:0
at System.Composition.CompositionContext.GetExport[TExport] (System.String contractName) [0x00000] in <9222e906419e4f47bc57ced5ad91678c>:0
at System.Composition.CompositionContext.GetExport[TExport] () [0x00000] in <9222e906419e4f47bc57ced5ad91678c>:0
at OmniSharp.Stdio.Host.Initialize () [0x0000d] in <2584067dfcea42a69c19a025cfbc4799>:0
at OmniSharp.Stdio.Host..ctor (System.IO.TextReader input, OmniSharp.Services.ISharedTextWriter writer, OmniSharp.IOmniSharpEnvironment environment, System.IServiceProvider serviceProvider, OmniSharp.CompositionHostBuilder compositionHostBuilder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Threading.CancellationTokenSource cancellationTokenSource) [0x0007b] in <2584067dfcea42a69c19a025cfbc4799>:0
at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.

b__1 () [0x0017d] in <1b91b6472b674f53a4fe2ae232ca9859>:0
at OmniSharp.CommandLineApplication+<>c__DisplayClass12_0.b__0 () [0x0000b] in <3d93fabea6954f4ba147450b0cf4332a>:0
at McMaster.Extensions.CommandLineUtils.CommandLineApplication+<>c__DisplayClass146_0.b__0 (System.Threading.CancellationToken _) [0x00000] in :0
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync (System.String[] args, System.Threading.CancellationToken cancellationToken) [0x000bf] in :0
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00016] in :0
at OmniSharp.CommandLineApplication.Execute (System.String[] args) [0x00081] in <3d93fabea6954f4ba147450b0cf4332a>:0
at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.b__0 () [0x00028] in <1b91b6472b674f53a4fe2ae232ca9859>:0
at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <3d93fabea6954f4ba147450b0cf4332a>:0

C# log

Post the output from Output-->C# here: The C# log is empty, no output

Environment information

VSCode version: 1.66.0
C# Extension: 1.24.3

Mono Information OmniSharp using built-in mono
Dotnet Information .NET SDK (reflecting any global.json): Version: 6.0.201 Commit: ef40e6aa06

Runtime Environment:
OS Name: debian
OS Version: 11
OS Platform: Linux
RID: debian.11-x64
Base Path: /usr/share/dotnet/sdk/6.0.201/

Host (useful for support):
Version: 6.0.3
Commit: c24d9a9c91

.NET SDKs installed:
6.0.201 [/usr/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

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

Visual Studio Code Extensions
Extension Author Version
csharp ms-dotnettools 1.24.3
docomment k--kato 0.1.30
dotnet-test-explorer formulahendry 0.7.7
EditorConfig EditorConfig 0.16.4
gitlens eamodio 12.0.5
markdown-preview-enhanced shd101wyy 0.6.2
powershell ms-vscode 2021.12.0
roslynator josefpihrt-vscode 4.1.0
vscode-solution-explorer fernandoescolar 0.4.5

Additional Information/Observations

As a result of this extension not loading the C# related features no longer work. For example F2 to rename an identifier does not work. Selecting any element then trying code actions with Ctrl+. results in message "No code actions available".

When I revert to version 1.24.1 of this extensions all works fine. Also checked version 1.24.2 which shows the same problem. Based on my experiments it appears as if this issue was absent in version 1.24.1 and introduced with version 1.24.2.

More details about my set up:

  • Windows 10 Pro version 10.0.19044 Build 1044
  • WSL2 with distro Ubuntu 20.04
  • Docker Desktop version 4.3.2
  • Dev container with base image mcr.microsoft.com/dotnet/sdk:6.0.201

I also tested with base image mcr.microsoft.com/dotnet/sdk:6.0.102. The observation remains the same.

@ManfredLange
Copy link
Author

ManfredLange commented Apr 2, 2022

In case you encounter this issue, one way to reverting back to a version without this issue present is using a "devcontainer.json" file that specifies which version of the extension you want to use. Here is an example:

{
   "name": "optarix-backend",
   "dockerComposeFile": [
      "docker-compose.yml"
   ],
   "service": "backend",
   "workspaceFolder": "/src",
   "extensions": [
      "fernandoescolar.vscode-solution-explorer",
      "formulahendry.dotnet-test-explorer",
      "eamodio.gitlens",
      "editorconfig.editorconfig",
      "josefpihrt-vscode.roslynator",
      "k--kato.docomment",
      "[email protected]",
      "ms-vscode.powershell",
      "shd101wyy.markdown-preview-enhanced"
   ],
   "remoteUser": "dev",
   "shutdownAction": "stopCompose"
}

@ManfredLange ManfredLange changed the title omnisharp-vscode version 1.24.3 does not load on debian omnisharp-vscode version 1.24.3 does not load on debian (possible other OS'es) Apr 2, 2022
@ManfredLange ManfredLange changed the title omnisharp-vscode version 1.24.3 does not load on debian (possible other OS'es) omnisharp-vscode version 1.24.3 does not load on debian (possibly other OS'es) Apr 2, 2022
@ManfredLange
Copy link
Author

ManfredLange commented Apr 2, 2022

The root cause for this issue could be similar to the one mentioned here: OmniSharp/omnisharp-roslyn#1421

Once I disable the extension josefpihrt-vscode.roslynator omnisharp loads.

@ManfredLange
Copy link
Author

ManfredLange commented Apr 2, 2022

Another observation: After omnisharp has started successfully, I can also install the extentions josefpihrt-vscode.roslynator without an issue.

However, if extension josefpihrt-vscode.roslynator is specified in devcontainer.json omnisharp tries to load it and fails with the TypeLoadException described above.

This observation applies to version 1.24.1 and 1.24.3 of omnisharp-vscode.

It appears as if either some files are missing when omnisharp is trying to load roslynator -or- it may be using a wrong path or directory when it attempts to load.

Or it is using an outdated and therefore incompatible version of roslynator. The most recent release of roslynator was on 30 Mar 2022 which is quite recent from a time perspective. omnisharp-vscode 1.24.3 was release 02 April 2022. This may have overlapped.

@ManfredLange
Copy link
Author

If the roslynator extension is not loaded by omnisharp but only after omnisharp finished loading, then I can manually install the roslynator extension successfully as well.

This observation applies to both docker base images, i.e., mcr.microsoft.com/dotnet/sdk:6.0.102 and mcr.microsoft.com/dotnet/sdk:6.0.201.

But even in that case, to get a clean omnisharp log output the following recipe seem to help:

  1. Start dev container with roslynator disabled. Wait for omnisharp to complete. You code base will show 1000s of issues.
  2. run dotnet restore --no-cache --force on your solution or project(s)
  3. run dotnet build for your solution or project(s)
  4. Reload VS Code Window (not a restart!)
  5. install roslynator extension manually

@filipw
Copy link
Contributor

filipw commented Apr 3, 2022

This manifests itself, I assume, only on the embedded Mono variant of OmniSharp. It is deprecated and will be removed in the next release.

Things should work correctly on the .NET 6.0 build of OmniSharp which you can enable by setting "omnisharp.useModernNet":true

@ghidalgo3
Copy link

Adding "OmniSharp.useModenNet": true also resolved an exception on macOS that completely broke OmniSharp at startup.

For reference, this is the exception:

mniSharp server started.
    Path: /Users/gustavo/.vscode/extensions/ms-dotnettools.csharp-1.24.3/.omnisharp/1.38.3-beta.31/run
    PID: 50269

System.TypeInitializationException: The type initializer for 'System.ComponentModel.TypeDescriptor' threw an exception. ---> System.DllNotFoundException: System.Native assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) Interop+Sys.GetNonCryptographicallySecureRandomBytes(byte*,int)
  at Interop.GetRandomBytes (System.Byte* buffer, System.Int32 length) [0x00000] in <ba70b91736bd40cb990a357097dba9c3>:0 
  at System.Guid.NewGuid () [0x00000] in <ba70b91736bd40cb990a357097dba9c3>:0 
  at System.ComponentModel.TypeDescriptor..cctor () [0x00034] in <bc69ad8632744cfba18f9705e53c6302>:0 
   --- End of inner exception stack trace ---
  at OmniSharp.Internal.CommandOptionExtensions.GetValueOrDefault[T] (McMaster.Extensions.CommandLineUtils.CommandOption opt, T defaultValue) [0x00008] in <b81453133ee74092816142afbffb5d49>:0 
  at OmniSharp.Stdio.StdioCommandLineApplication.get_Encoding () [0x00000] in <ff89c28654c64c08be0af235972b4254>:0 
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.<Main>b__1 () [0x00000] in <4061e52126604f67b6d455853ab7baf7>:0 
  at OmniSharp.CommandLineApplication+<>c__DisplayClass12_0.<OnExecute>b__0 () [0x0000b] in <b81453133ee74092816142afbffb5d49>:0 
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication+<>c__DisplayClass146_0.<OnExecute>b__0 (System.Threading.CancellationToken _) [0x00000] in <abe0fc6797a94a73931eea5cecaffd78>:0 
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync (System.String[] args, System.Threading.CancellationToken cancellationToken) [0x000bf] in <abe0fc6797a94a73931eea5cecaffd78>:0 
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00016] in <abe0fc6797a94a73931eea5cecaffd78>:0 
  at OmniSharp.CommandLineApplication.Execute (System.String[] args) [0x00081] in <b81453133ee74092816142afbffb5d49>:0 
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__0 () [0x00028] in <4061e52126604f67b6d455853ab7baf7>:0 
  at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <b81453133ee74092816142afbffb5d49>:0 

@ManfredLange
Copy link
Author

@filipw That seems to have done the trick. It also appears to have solve a few other smaller issues.

Thank you for the fast response!

I'll close this issue for now as it appears to be resolved. In case I run into the same or similar issue I'll submit a new issue.

@NoTuxNoBux
Copy link

NoTuxNoBux commented Apr 8, 2022

Things should work correctly on the .NET 6.0 build of OmniSharp which you can enable by setting "omnisharp.useModernNet":true

If I understand correctly, with the knowledge from #5120, this means that Unity projects are now broken (somewhat faster than announced 😄)? I can fix the error above by switching to modern .NET, but then my Unity projects don't work any more.

@filipw
Copy link
Contributor

filipw commented Apr 8, 2022

OmniSharp used to have two variants:

  • embedded Mono (default one), which only supported .NET Core projects and was not compatible with Unity
  • global Mono (which could be enabled by setting "omnisharp.useGlobalMono":"always"), which supported .NET Framework projects such as Unity, and if the MSBuild version in the global Mono was appropriate might also support .NET Core development

The new .NET 6.0 build, which is enabled by setting "omnisharp.useModernNet":true is a replacement for the embedded Mono and intended for .NET Core development.

The other mode (global Mono) is still there and remains the official way of dealing with Unity until Unity moves to .NET 6.0 (or at least to new .NET project format), so that should not be affected.

@NoTuxNoBux
Copy link

NoTuxNoBux commented Apr 8, 2022

Okay, that is good to hear - but is it possible this issue has been closed too quickly in that case? I'm using global mono ("omnisharp.useGlobalMono":"always") for Unity as before, and am still encountering the above issue in the OP. I have "omnisharp.useModernNet":false set now to avoid it for the time being.

I'm also on (Arch) Linux, so this may be Linux-specific (or rather: non-Windows-specific).

EDIT: I have Mono 6.12 installed, as well as mono-msbuild and mono-msbuild-sdkresolver, which are all listed on the Arch wiki as being required, and this also worked fine before the update to 1.24.3.

Logs, in case it helps:


[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on arch 0.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to /usr/share/dotnet/dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Mono 16.10.1 - "/usr/lib/mono/msbuild/Current/bin"
            2: StandAlone 17.1.1 - "/home/user/.vscode-oss/extensions/ms-dotnettools.csharp-1.24.3-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Mono 16.10.1 - "/usr/lib/mono/msbuild/Current/bin"
            CscToolExe = csc.exe
            CscToolPath = /home/user/.vscode-oss/extensions/ms-dotnettools.csharp-1.24.3-linux-x64/.omnisharp/1.38.2/omnisharp/.msbuild/Current/Bin/Roslyn
System.TypeLoadException: Could not load type of field 'Roslynator.Host.Mef.MefHostServices:_compositionContext' (2) due to: Could not load file or assembly 'System.Composition.Runtime, Version=1.0.31.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,System.RuntimeType/MemberListType)
  at System.RuntimeType.GetPropertiesByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.RuntimeType+MemberListType listType, System.RuntimeType reflectedType) [0x0001b] in <62b430b945fa49a19a75382ef03e7bed>:0 
  at System.RuntimeType.GetPropertyCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Type[] types, System.Boolean allowPrefixLookup) [0x00010] in <62b430b945fa49a19a75382ef03e7bed>:0 
  at System.RuntimeType.GetProperties (System.Reflection.BindingFlags bindingAttr) [0x00000] in <62b430b945fa49a19a75382ef03e7bed>:0 
  at System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties (System.Type type) [0x00014] in <62b430b945fa49a19a75382ef03e7bed>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverPropertyExports>d__7.MoveNext () [0x00037] in <2d4bd81b7fea479cb0a52f844b6edf97>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverExports>d__5.MoveNext () [0x000db] in <2d4bd81b7fea479cb0a52f844b6edf97>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart (System.Reflection.TypeInfo type, System.Composition.TypedParts.Discovery.DiscoveredPart& part) [0x00061] in <2d4bd81b7fea479cb0a52f844b6edf97>:0 
  at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (System.Collections.Generic.IEnumerable`1[T] types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00037] in <2d4bd81b7fea479cb0a52f844b6edf97>:0 
  at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00042] in <2d4bd81b7fea479cb0a52f844b6edf97>:0 
  at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x00031] in <f78fde32b7b244ca95ad9f75f5377ae7>:0 
  at OmniSharp.HostServicesAggregator.CreateHostServices () [0x00000] in <407751de6f434a52aa536ffcf396059d>:0 
  at OmniSharp.OmniSharpWorkspace..ctor (OmniSharp.HostServicesAggregator aggregator, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, OmniSharp.FileWatching.IFileSystemWatcher fileSystemWatcher) [0x00046] in <407751de6f434a52aa536ffcf396059d>:0 
  at (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,System.Composition.Hosting.Core.LifetimeContext,System.Composition.Hosting.Core.CompositionOperation)
  at System.Composition.TypedParts.ActivationFeatures.DisposalFeature+<>c__DisplayClass0_0.<RewriteActivator>b__0 (System.Composition.Hosting.Core.LifetimeContext c, System.Composition.Hosting.Core.CompositionOperation o) [0x00000] in <2d4bd81b7fea479cb0a52f844b6edf97>:0 
  at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate (System.Int32 sharingId, System.Composition.Hosting.Core.CompositionOperation operation, System.Composition.Hosting.Core.CompositeActivator creator) [0x000a8] in <db7a9e9ce8f2483abd2dba005db8e856>:0 
  at System.Composition.TypedParts.ActivationFeatures.LifetimeFeature+<>c__DisplayClass1_0.<RewriteActivator>b__0 (System.Composition.Hosting.Core.LifetimeContext c, System.Composition.Hosting.Core.CompositionOperation o) [0x00011] in <2d4bd81b7fea479cb0a52f844b6edf97>:0 
  at System.Composition.Hosting.Core.CompositionOperation.Run (System.Composition.Hosting.Core.LifetimeContext outermostLifetimeContext, System.Composition.Hosting.Core.CompositeActivator compositionRootActivator) [0x00022] in <db7a9e9ce8f2483abd2dba005db8e856>:0 
  at System.Composition.Hosting.Core.LifetimeContext.TryGetExport (System.Composition.Hosting.Core.CompositionContract contract, System.Object& export) [0x0001d] in <db7a9e9ce8f2483abd2dba005db8e856>:0 
  at System.Composition.Hosting.CompositionHost.TryGetExport (System.Composition.Hosting.Core.CompositionContract contract, System.Object& export) [0x00000] in <db7a9e9ce8f2483abd2dba005db8e856>:0 
  at System.Composition.CompositionContext.GetExport (System.Composition.Hosting.Core.CompositionContract contract) [0x00000] in <9222e906419e4f47bc57ced5ad91678c>:0 
  at System.Composition.CompositionContext.GetExport (System.Type exportType, System.String contractName) [0x00008] in <9222e906419e4f47bc57ced5ad91678c>:0 
  at System.Composition.CompositionContext.GetExport[TExport] (System.String contractName) [0x00000] in <9222e906419e4f47bc57ced5ad91678c>:0 
  at System.Composition.CompositionContext.GetExport[TExport] () [0x00000] in <9222e906419e4f47bc57ced5ad91678c>:0 
  at OmniSharp.Stdio.Host.Initialize () [0x0000d] in <2584067dfcea42a69c19a025cfbc4799>:0 
  at OmniSharp.Stdio.Host..ctor (System.IO.TextReader input, OmniSharp.Services.ISharedTextWriter writer, OmniSharp.IOmniSharpEnvironment environment, System.IServiceProvider serviceProvider, OmniSharp.CompositionHostBuilder compositionHostBuilder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Threading.CancellationTokenSource cancellationTokenSource) [0x0007b] in <2584067dfcea42a69c19a025cfbc4799>:0 
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.<Main>b__1 () [0x0017d] in <1b91b6472b674f53a4fe2ae232ca9859>:0 
  at OmniSharp.CommandLineApplication+<>c__DisplayClass12_0.<OnExecute>b__0 () [0x0000b] in <3d93fabea6954f4ba147450b0cf4332a>:0 
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication+<>c__DisplayClass146_0.<OnExecute>b__0 (System.Threading.CancellationToken _) [0x00000] in <abe0fc6797a94a73931eea5cecaffd78>:0 
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync (System.String[] args, System.Threading.CancellationToken cancellationToken) [0x000bf] in <abe0fc6797a94a73931eea5cecaffd78>:0 
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00016] in <abe0fc6797a94a73931eea5cecaffd78>:0 
  at OmniSharp.CommandLineApplication.Execute (System.String[] args) [0x00081] in <3d93fabea6954f4ba147450b0cf4332a>:0 
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__0 () [0x00028] in <1b91b6472b674f53a4fe2ae232ca9859>:0 
  at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <3d93fabea6954f4ba147450b0cf4332a>:0 
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).

EDIT2: I just realized the error is related to Roslynator, and this is a PEBKAC problem. I disabled Roslynator globally but the DLLs were inserted in omnisharp.json again at some point.

@filipw
Copy link
Contributor

filipw commented Apr 8, 2022

I believe the Roslynator extension manipulates omnisharp.json on install to inject its assemblies into the OminSharp extensions to be loaded, and even when you remove Roslynator, the file would stay modified. But yeah this is external dependency issue in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants