csharp-language-server icon indicating copy to clipboard operation
csharp-language-server copied to clipboard

Doesn't work if multiple target frameworks are specified in the csproj

Open amagee opened this issue 2 years ago • 3 comments

I'm using csharp-ls 0.6.1 via neovim and nvim-lspconfig.

I can reproduce the problem with a project with a single .cs file:

using System;

namespace dotnet
{
  class Program
  {
    static void Main(string[] args)
    {
      var a = args;
    }
  }
}

If my .csproj file contains this:

<TargetFrameworks>net6.0;net7.0</TargetFrameworks>

then the LSP appears to initialise fine - I do not see anything that looks problematic in the logs, but none of the functionality works. Eg. if I have my cursor on the args in var a = args and try go-to-definition, nothing happens, and the logs say that the language server reported "No location found".

However if I replace the TargetFrameworks line in the csproj with any of the following, everything works fine:

<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net7.0</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>

amagee avatar Mar 11 '23 23:03 amagee

I'm having the same problem.

Brent7788 avatar Jul 12 '23 18:07 Brent7788

Same here with net8.0 and net48 multitarget

molostovvs avatar Mar 26 '24 21:03 molostovvs

Still having this issue on latest when specifying net6/net8. Any update? If someone can point me in the right direction, I can attempt to help out.

zachgharst avatar May 15 '24 03:05 zachgharst