Skip to content

[BUG] Omisharp LSP fails to attach #3217

Closed
@Houdiee

Description

@Houdiee

Can't get C# lsps to work no matter what. It used to work on stable version but no longer works when I switched to unstable.

Field Description
Plugin lsp.servers.omnisharp
Plugin lsp.servers.csharp_ls
Nixpkgs unstable
Home Manager unstable
  • I have read the FAQ and my bug is not listed there.

Description

Setting lsp.servers.omnisharp.enable = true or lsp.servers.csharp_ls.enable = true will load the lsp client, but no matter wether or not I have dotnet 8 or dotnet 9 (or both) installed, i get the following error from LspLog:

[ERROR][2025-04-25 13:00:26] ...p/_transport.lua:36	"rpc"	"csharp-ls"	"stderr"	"You must install or update .NET to run this application.\n\nApp: /nix/store/gc9as1mb01l7pjzc0dksfg3smlmsjds8-csharp-ls-0.16.0/lib/csharp-ls/csharp-ls\nArchitecture: x64\nFramework: 'Microsoft.NETCore.App', version '8.0.0' (x64)\n.NET location: /nix/store/hzdqc45clz93vdrhwmdd87zc92r2bwwc-dotnet-sdk-9.0.105/share/dotnet\n\nThe following frameworks were found:\n  9.0.4 at [/nix/store/hzdqc45clz93vdrhwmdd87zc92r2bwwc-dotnet-sdk-9.0.105/share/dotnet/shared/Microsoft.NETCore.App]\n\nLearn more:\nhttps://aka.ms/dotnet/app-launch-failed\n\nTo install missing framework, download:\nhttps://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0&arch=x64&rid=linux-x64&os=nixos.25.05\n"
[ERROR][2025-04-25 13:00:27] ...p/_transport.lua:36	"rpc"	"dotnet"	"stderr"	"Could not execute because the specified command or file was not found."
[ERROR][2025-04-25 13:00:27] ...p/_transport.lua:36	"rpc"	"dotnet"	"stderr"	"\n"
[START][2025-04-25 13:05:34] LSP logging initiated
[ERROR][2025-04-25 13:05:34] ...p/_transport.lua:36	"rpc"	"csharp-ls"	"stderr"	"You must install or update .NET to run this application.\n\nApp: /nix/store/gc9as1mb01l7pjzc0dksfg3smlmsjds8-csharp-ls-0.16.0/lib/csharp-ls/csharp-ls\nArchitecture: x64\nFramework: 'Microsoft.NETCore.App', version '8.0.0' (x64)\n.NET location: /nix/store/hzdqc45clz93vdrhwmdd87zc92r2bwwc-dotnet-sdk-9.0.105/share/dotnet\n\nThe following frameworks were found:\n  9.0.4 at [/nix/store/hzdqc45clz93vdrhwmdd87zc92r2bwwc-dotnet-sdk-9.0.105/share/dotnet/shared/Microsoft.NETCore.App]\n"
[ERROR][2025-04-25 13:05:34] ...p/_transport.lua:36	"rpc"	"csharp-ls"	"stderr"	"\nLearn more:\nhttps://aka.ms/dotnet/app-launch-failed\n\nTo install missing framework, download:\nhttps://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0&arch=x64&rid=linux-x64&os=nixos.25.05\n"
[ERROR][2025-04-25 13:05:34] ...p/_transport.lua:36	"rpc"	"dotnet"	"stderr"	"Could not execute because the specified command or file was not found.\n"

Minimal, Reproducible Example (MRE)

# nixvim.nix:

  csharp_ls.enable = true;
  omnisharp = {
    enable = true;
    cmd = [
      # "${pkgs.dotnetCorePackages.dotnet_9.sdk}/bin/dotnet" also tried doing this but didnt work
      "dotnet"
      "${pkgs.omnisharp-roslyn}/bin/OmniSharp" 
    ];
  };


# configuration.nix:
  environment.systemPackages = with pkgs; [
    dotnetCorePackages.dotnet_9.sdk
    dotnetCorePackages.dotnet_8.sdk
  ];

Any help would be very much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions