OmniSharp / omnisharp-vim

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

Omnisharp Server fails to load project files #811

Closed tonymishler closed 1 year ago

tonymishler commented 1 year ago

When the server is attempting to load projects they all fail on the same missing method

[fail]: OmniSharp.MSBuild.ProjectManager 27 Failed to load project file 'C:\Users\tonym\source\repos\ButlerTransportation\ImageRetrievalWeb\ImageRetrievalWeb.csproj'. 26 System.MissingMethodException: Method not found: 'System.ReadOnlySpan1 Microsoft.IO.Path.GetFileName(System.ReadOnlySpan1<Char>)'. 25 at Microsoft.Build.Shared.FileMatcher.IsFileNameMatch(String path, String pattern)

I'm running on windows 11 using nvim. I installed the the server using Mason

and the OmniSharp using Packer with the following configuration use { "OmniSharp/omnisharp-vim", config = function() vim.g.OmniSharp_server_path = "C:\\Users\\tonym\\AppData\\Local\\omnisharp-vim\\omnisharp-roslyn\\OmniSharp.exe" vim.g.OmniSharp_server_stdio_quickload = 1 vim.g.OmniSharp_server_use_net6 = 1 end, }

nickspoons commented 1 year ago

I installed the the server using Mason

I don't know what this means. Can't you just let OmniSharp-vim install the server?

tonymishler commented 1 year ago

When I did that the server would never even attempt to start. I'll try it again and see what the logs say

nickspoons commented 1 year ago

It looks like the same issue as https://github.com/OmniSharp/omnisharp-vim/issues/803 which should be resolved, a server error which has been fixed.

tonymishler commented 1 year ago

using net6 combined with the server that comes from a OmniSharp-vim install fixed it. Thanks!

nickspoons commented 1 year ago

Cool, glad to hear!

rcmosher commented 1 year ago

Edit: working around the install issue by running the powershell script directly in powershell has resolved it for me on Windows. And installing from Windows seems to have resolved it for WSL as well. Not sure how it knew which directory to use as WSL installed to omnisharp-rosly and windows to omnisharp-roslyn.

@tonymishler What exact steps did you take to resolve this? I'm having the same issue in WSL but am unable to resolve even with the latest beta of OmniSharp. I tried installing in Windows to make sure WSL wasn't the problem but have the same issue. Though I didn't do a standard OmniSharpInstall as that errors out on me currently.

tonymishler commented 1 year ago

I uninstalled the Mason install of the server and did a fresh install with packer of OmniSharp and it worked. Be aware that it will tell you a server isn't started if it can't detect a .sln file in your vim context. Make sure to start nvim in the directory that contains the .sln file.

nickspoons commented 1 year ago

You don't need to start vim in a directory containing a .sln. We find the .sln by searching up the directory tree from a .cs file. You can have multiple solutions open simultaneously in a single vim session, but no server will be started until you open a .cs file.