OmniSharp / omnisharp-vim

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

Net6.0 not building with Omnisharp-Vim #786

Closed Drewfyre closed 2 years ago

Drewfyre commented 2 years ago

Hi,

since we upgraded our solution to net6.0 omnisharp stopped worked for me. Whenever I open one of the projects in vim os fails to load the project.

I have these error messages in the log:

image

The projects/solution works fine in Visual Studio and JetBrains Rider, so I don't think it's a problem with installed versions of dotnet or MSBuild.

nickspoons commented 2 years ago

Are you using the net6 native server? Enable it with let g:OmniSharp_server_use_net6 = 1 in your .vimrc and then install the server.

Drewfyre commented 2 years ago

Are you using the net6 native server? Enable it with let g:OmniSharp_server_use_net6 = 1 in your .vimrc and then install the server.

I did what you suggested but the problem remains. Afterwards also tried removing and reinstalling the plugin completely and running the install again with this option. However still the same problem.

Any other ideas? Is there any more info I can provide which would help you?

nickspoons commented 2 years ago

I'm not sure. I don't suppose you can provide a repro solution? What OS are you running on. What did you upgrade your solution from?

Drewfyre commented 2 years ago

Sadly no I cannot provide a repro solution as it is closed source. I also cannot reproduce this with a new solution, it doesn't happen if I start a new project/solution.

I'm running on Win10 64bit. Upgrade was from .net core 3.1. We upgraded all projects and class libs, so there is nothing left on a lower version than .net6

Drewfyre commented 2 years ago

Is there a way to confirm this let g:OmniSharp_server_use_net6 = 1 worked and it is correctly installed and using the native server?

nickspoons commented 2 years ago

Is there a way to confirm this let g:OmniSharp_server_use_net6 = 1 worked and it is correctly installed and using the native server?

You can look at the folder where OmniSharp-roslyn has been extracted (check :OmniSharpOpenLog for the location). The net6 version contains a OmniSharp.dll.config file whereas the framework version contains an OmniSharp.exe.config file.

nickspoons commented 2 years ago

(I'm not actually on a Windows machine just now, just comparing the contents of the omnisharp-win-x86-net6.0.zip and omnisharp-win-x86.zip releases )

nickspoons commented 2 years ago

If your issue is not happening with other net6 solutions (they work correctly), then it sounds like the plugin is working correctly but your solution may be configured in a way that that OmniSharp-roslyn server can't handle. You could try opening an issue there, although I'm not sure if they'll be able to help without a reproducible example or full log.

Perhaps try copying your solution file and one of the .csproj files to a new location, and use those as a base to build a sample (with no proprietary code) that shows the problem?

Drewfyre commented 2 years ago

Is there a way to confirm this let g:OmniSharp_server_use_net6 = 1 worked and it is correctly installed and using the native server?

You can look at the folder where OmniSharp-roslyn has been extracted (check :OmniSharpOpenLog for the location). The net6 version contains a OmniSharp.dll.config file whereas the framework version contains an OmniSharp.exe.config file.

Ok for me it does not have the .dll.config only the .exe.config. So it seems that the option and install of the native server didn't work.

image

Drewfyre commented 2 years ago

Ah yes I have manually downloaded the omnisharp-win-x64-net6.0.zip from the releases page and extractet that into the omnisharp-vim/omnisharp-roslyn path and voila everything works now. So it just didn't download the correct version for me eventhough the option is set in my .vimrc file.

nickspoons commented 2 years ago

Oh! I'm sorry you're quite right, the Windows installer doesn't respect the net6 option. As I say I don't use Windows as a primary OS and I forgot I hadn't handled it there. Also because getting net6 support working properly has been more of a priority on linux/mac/wsl where the mono dependency was often a problem.

I'm very glad to hear that OmniSharp-vim works correctly with the net6 server on Windows though, thanks for letting me know.

nickspoons commented 2 years ago

OK now the net6 version of the server is installable on Windows.

Drewfyre commented 2 years ago

Cool, thanks for the fix!