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 error #5179

Closed
dreamMoli opened this issue Apr 21, 2022 · 1 comment · Fixed by OmniSharp/omnisharp-roslyn#2398
Closed

omnisharp error #5179

dreamMoli opened this issue Apr 21, 2022 · 1 comment · Fixed by OmniSharp/omnisharp-roslyn#2398

Comments

@dreamMoli
Copy link

When I open c# project ,omnisharp error...

Environment data

dotnet --info output:
.NET SDK (reflecting any global.json):
Version: 7.0.100-preview.3.22179.4
Commit: c48f2c30ee

Runtime 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/7.0.100-preview.3.22179.4/

Host (useful for support):
Version: 7.0.0-preview.3.22175.4
Commit: 162f83657c

.NET SDKs installed:
7.0.100-preview.3.22179.4 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.0-preview.3.22178.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.0-preview.3.22175.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

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

VS Code version:
Version: 1.67.0-insider
Commit: e7c6ad74aff28965d0189ca1dd584f5e9829cf06
Date: 2022-04-19T05:18:48.693Z (2 days ago)
Electron: 17.4.0
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Darwin x64 18.5.0

C# Extension version: v1.24.4

mono version:
Mono JIT compiler version 6.12.0.174 (2020-02/adf1bc4335d Tue Mar 22 17:57:38 EDT 2022)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS:
SIGSEGV: altstack
Notification: kqueue
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(610)
Suspend: hybrid
GC: sgen (concurrent by default)

OmniSharp log

if omnisharp config:
"omnisharp.path": "latest",
"omnisharp.useGlobalMono": "never",
"omnisharp.projectLoadTimeout":500,

Starting OmniSharp server at 4/21/2022, 1:52:05 PM
Target: /Users/gtl/Desktop/testrunner/testomnisharp

OmniSharp server started.
Path: /Users/gtl/.vscode-insiders/extensions/ms-dotnettools.csharp-1.24.4-darwin-x64/.omnisharp/1.38.3-beta.67/run
PID: 23384

System.TypeInitializationException: The type initializer for 'System.ComponentModel.TypeDescriptor' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Sys' threw an exception. ---> System.DllNotFoundException: System.Native assembly: type: member:(null)
at (wrapper managed-to-native) Interop+Sys.LChflagsCanSetHiddenFlag()
at Interop+Sys..cctor () [0x00000] in <0e2013ab6b944e008349d8dcd759ab4d>:0
--- End of inner exception stack trace ---
at Interop.GetRandomBytes (System.Byte* buffer, System.Int32 length) [0x00000] in <0e2013ab6b944e008349d8dcd759ab4d>:0
at System.Guid.NewGuid () [0x00000] in <0e2013ab6b944e008349d8dcd759ab4d>:0
at System.ComponentModel.TypeDescriptor..cctor () [0x00034] in <81c889a3fdaf408aacac8a870695982b>:0
--- End of inner exception stack trace ---
at OmniSharp.Internal.CommandOptionExtensions.GetValueOrDefault[T] (McMaster.Extensions.CommandLineUtils.CommandOption opt, T defaultValue) [0x00008] in <55b1ee2aa809491890804938d5fc6a47>:0
at OmniSharp.Stdio.StdioCommandLineApplication.get_Encoding () [0x00000] in <6debec82860f43eba1d26ab7fda26428>:0
at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.

b__1 () [0x00000] in <65498930c054400fad9067d1e841386d>:0
at OmniSharp.CommandLineApplication+<>c__DisplayClass12_0.b__0 () [0x0000b] in <55b1ee2aa809491890804938d5fc6a47>: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 <55b1ee2aa809491890804938d5fc6a47>:0
at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.b__0 () [0x00028] in <65498930c054400fad9067d1e841386d>:0
at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <55b1ee2aa809491890804938d5fc6a47>:0

if omnisharp config:
"omnisharp.path": "latest",
"omnisharp.useGlobalMono": "always",
"omnisharp.projectLoadTimeout":500,

Starting OmniSharp server at 4/21/2022, 2:24:55 PM
Target: /Users/gtl/Desktop/testrunner/testomnisharp

OmniSharp server started with Mono 6.12.0.
Path: /Users/gtl/.vscode-insiders/extensions/ms-dotnettools.csharp-1.24.4-darwin-x64/.omnisharp/1.38.3-beta.67/omnisharp/OmniSharp.exe
PID: 32694

Starting OmniSharp on MacOS 10.14.4 (x64)
info: OmniSharp.Services.DotNetCliService
Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
info: OmniSharp.Services.DotNetCliService
DotNetPath set to /usr/local/share/dotnet/dotnet
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: Mono 16.10.1 - "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Mono 16.10.1 - "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin"
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
info: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/Users/gtl/Desktop/testrunner/testomnisharp'.
info: OmniSharp.Cake.CakeProjectSystem
Did not find any Cake files
info: OmniSharp.MSBuild.ProjectSystem
No solution files found in '/Users/gtl/Desktop/testrunner/testomnisharp'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for '/Users/gtl/Desktop/testrunner/testomnisharp/testomnisharp.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/Users/gtl/Desktop/testrunner/testomnisharp'.
info: OmniSharp.Script.ScriptProjectSystem
Did not find any CSX files
info: OmniSharp.WorkspaceInitializer
Configuration finished.
info: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/Users/gtl/Desktop/testrunner/testomnisharp' on host 32367.
info: OmniSharp.MSBuild.ProjectManager
Loading project: /Users/gtl/Desktop/testrunner/testomnisharp/testomnisharp.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
The reference assemblies for ".NETFramework,Version=v7.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK.
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file '/Users/gtl/Desktop/testrunner/testomnisharp/testomnisharp.csproj'.
/Users/gtl/Desktop/testrunner/testomnisharp/testomnisharp.csproj
/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(1232,5): Error: The reference assemblies for ".NETFramework,Version=v7.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK.

Steps to reproduce

open a C# project

Expected behavior

Omnisharp starts

Actual behavior

Omnisharp error

@filipw
Copy link
Contributor

filipw commented May 9, 2022

"omnisharp.useGlobalMono": "never", is no longer used in the latest server bits, because the embedded Mono has been removed (your settings opt into latest bits).

You should enable "omnisharp.useModernNet": true" instead to use the .NET 6 version rather than global Mono .

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

Successfully merging a pull request may close this issue.

2 participants