System.TypeLoadException
See original GitHub issueIssue Description
System.TypeLoadException: Could not load type of field 'Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser:_context' (1)
Steps to Reproduce
omnisharp instantly reports the issue when starting vscode or restarting omnisharp
OmniSharp log
Starting OmniSharp server at 2019-07-20, 11:07:12 a.m.
Target: correct_path_to_sln (redacted)
OmniSharp server started with Mono 5.18.1.
Path: /Users/keeganstothert/.vscode/extensions/ms-vscode.csharp-1.21.0/.omnisharp/1.34.0/omnisharp/OmniSharp.exe
PID: 95137
System.TypeLoadException: Could not load type of field 'Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser:_context' (1) due to: Could not resolve type with token 01000018 from typeref (expected class 'System.Collections.Generic.Stack`1' in assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51') assembly:netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 type:System.Collections.Generic.Stack`1 member:(null)
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load (System.Boolean reload) [0x0010b] in <5b0219d367fd4fd68bb5d8e979bb16b3>:0
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load () [0x00000] in <5b0219d367fd4fd68bb5d8e979bb16b3>:0
at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor (System.Collections.Generic.IList`1[T] providers) [0x0003b] in <c58a7bdd3f5a468aa1ce25bba6f36889>:0
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build () [0x0003c] in <c58a7bdd3f5a468aa1ce25bba6f36889>:0
at OmniSharp.ConfigurationBuilder.Build () [0x00073] in <2a5906ca9ef7486cb9ec80794c73eb10>:0
at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.<Main>b__1 () [0x000bc] in <8c5dac6e15f8406f96c0166019f5cce3>:0
at OmniSharp.CommandLineApplication+<>c__DisplayClass11_0.<OnExecute>b__0 () [0x0000b] in <2a5906ca9ef7486cb9ec80794c73eb10>: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 <2a5906ca9ef7486cb9ec80794c73eb10>:0
at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__0 () [0x00028] in <8c5dac6e15f8406f96c0166019f5cce3>:0
at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <2a5906ca9ef7486cb9ec80794c73eb10>:0
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).
C# log
empty
Environment information
VSCode version: 1.36.1 C# Extension: 1.21.0
Mono Information
OmniSharp using global mono :5.18.1Dotnet Information
.NET Core SDK (reflecting any global.json): Version: 2.2.301 Commit: 70d6be0814Runtime Environment: 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.301/
Host (useful for support): Version: 3.0.0-preview6-27804-01 Commit: fdf81c6faf
.NET Core SDKs installed: 2.2.301 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.0-preview6.19307.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.0-preview6-27804-01 [/usr/local/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 |
---|---|---|
atom-keybindings | ms-vscode | 3.0.6 |
code-settings-sync | Shan | 3.4.0 |
cpptools | ms-vscode | 0.24.0 |
csharp | ms-vscode | 1.21.0 |
es7-react-js-snippets | dsznajder | 2.3.0 |
hide-gitignored | npxms | 1.0.1 |
markdown-all-in-one | yzhang | 2.4.0 |
Material-theme | zhuangtongfa | 2.26.0 |
msbuild-project-tools | tintoy | 0.2.55 |
prettier-vscode | esbenp | 1.9.0 |
python | ms-python | 2019.6.24221 |
restructuredtext | lextudio | 113.0.0 |
rust | rust-lang | 0.6.1 |
unity-tools | Tobiah | 1.1.1 |
vscode-apollo | apollographql | 1.7.4 |
vscode-arduino | vsciot-vscode | 0.2.27 |
vscode-eslint | dbaeumer | 1.9.0 |
vscode-great-icons | emmanuelbeziat | 2.1.47 |
vscode-styled-jsx | blanu | 1.5.0 |
vscode-theme-onelight | akamud | 2.1.0 |
vscode-typescript-tslint-plugin | ms-vscode | 1.2.2 |
write-good-linter | travisthetechie | 0.1.1 |
I have tried every step in all similar issues. I have uninstalled and reinstalled mono, unity, dotnet, and vscode. i’ve had similar issues with omnisharp in the past and was able to resolve them with some combination of the above and messing with “omnisharp.path”: “latest”, but this time nothing is working
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (4 by maintainers)
Top GitHub Comments
downgrading my c# extension to 1.20.0 fixed a similar issue for me on OSX… I was getting an error around
System.TypeInitializationException: The type initializer for 'Microsoft.Build.Shared.NativeMethodsShared' threw an exception.
if it seems related enough to this I can re-upgrade and then capture the entire error message but I didn’t have to touch anything w/ mono directly to resolve. just downgrade from 1.20.1 -> 1.20.0
Facing same error