OmniSharp / omnisharp-vim

Vim omnicompletion (intellisense) and more for C#
http://www.omnisharp.net
MIT License
1.72k stars 168 forks source link

Failing to work with .NET 7 binaries #824

Closed WhiteBlackGoose closed 2 years ago

WhiteBlackGoose commented 2 years ago

Hello!

I'm not entirely sure it's omnisharp-vim's issue (and not mine). Here's a thing, it fails to find some native library:

A fatal error occurred. The required library libhostfxr.so could not be found.

To collect errors, I run

$ COREHOST_TRACE=1 COREHOST_TRACEFILE=/tmp/host_trace.txt nvim Program.cs

Here's the log

$ cat /tmp/host_trace.txt
Tracing enabled @ Wed Nov 16 14:30:25 2022 GMT
--- Invoked apphost [version: 6.0.0-preview.7.21317.1, commit hash: 96a4671bc52e70024da409f5f48b0abaa30cb901] main = {
/home/goose/.cache/omnisharp-vim/omnisharp-roslyn/OmniSharp
-s
/home/goose/prj/AM/CLI
-e
utf-8
}
The managed DLL bound to this executable is: 'OmniSharp.dll'
Using environment variable DOTNET_ROOT=[/home/goose/.dotnet] as runtime location.
Looking for install_location file in '/etc/dotnet/install_location'.
The install_location file failed to open.
A fatal error occurred. The required library libhostfxr.so could not be found.
If this is a self-contained application, that library should exist in [/home/goose/.cache/omnisharp-vim/omnisharp-roslyn/].
If this is a framework-dependent application, install the runtime in the global location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].

The .NET runtime can be found at:
  - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=debian-x64&apphost_version=6.0.0-preview.7.21317.1

If we look closer,

Looking for install_location file in '/etc/dotnet/install_location'.
The install_location file failed to open.

No wonder it failed to open, it's not there.

Env info:

$ dotnet --info
.NET SDK:
 Version:   7.0.100
 Commit:    e12b7af219

Runtime Environment:
 OS Name:     debian
 OS Version:  
 OS Platform: Linux
 RID:         debian-x64
 Base Path:   /home/goose/programs/dotnet-folder/sdk/7.0.100/

Host:
  Version:      7.0.0
  Architecture: x64
  Commit:       d099f075e4

.NET SDKs installed:
  7.0.100 [/home/goose/programs/dotnet-folder/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.0 [/home/goose/programs/dotnet-folder/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.0 [/home/goose/programs/dotnet-folder/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/home/goose/.dotnet]

global.json file:
  Not found
$ uname -a
Linux samsung-debian 5.10.0-18-amd64 #1 SMP Debian 5.10.140-1 (2022-09-02) x86_64 GNU/Linux
$ nvim --version | head -n 1
NVIM v0.8.0-1210-gd367ed9b2
WhiteBlackGoose commented 2 years ago

Skill issue :rofl:

~/.bashrc

- export DOTNET_ROOT="/home/goose/.dotnet"
+ export DOTNET_ROOT="/home/goose/where-your-actual-binaries-are"