Open Shihira opened 6 years ago
There is a change that hasn't been implemented that lets null through correctly, however I don't think we're using that version of the library yet. I'm going to try and take some time this weekend and finish up my changes on the library and roll them back into omnisharp.
Recently I switched to vim-lsp and tried the latest version of omnisharp-roslyn, and it doesn't work either. Here is the log:
Tue 19 Jun 2018 05:52:15 PM HKT:["--->",1,"omnisharp",{"method":"initialize","params":{"rootUri":"file:///home/shihira/Program/Unity/Vitruvius/Assets/BuildMode/Scripts","initializationOptions":{},"capabilities":{"textDocument":{"completion":{"completionItem":{"snippetSupport":false}}}},"rootPath":"/home/shihira/Program/Unity/Vitruvius/Assets/BuildMode/Scripts","trace":"off"}}]
Tue 19 Jun 2018 05:52:16 PM HKT:["<---",1,"omnisharp",{"response":{"protocolVersion":"2.0","method":"window/logMessage","params":{"message":"Starting server...","type":4}}}]
Tue 19 Jun 2018 05:52:16 PM HKT:["<---",1,"omnisharp",{"response":{"protocolVersion":"2.0","method":"window/logMessage","params":{"message":"Added handlers... waiting for initialize...","type":4}}}]
Tue 19 Jun 2018 05:52:16 PM HKT:["<---",1,"omnisharp",{"response":{"protocolVersion":"2.0","method":"window/logMessage","params":{"message":"[crit]: OmniSharp.Extensions.LanguageServer.LspRequestRouter\n Failed to handle notification initialize\nSystem.NullReferenceException: Object reference not set to an instance of an object\n at OmniSharp.Extensions.LanguageServer.LanguageServer+<OmniSharp-Extensions-JsonRpc-IRequestHandler<OmniSharp-Extensions-LanguageServer-Models-InitializeParams\\,OmniSharp-Extensions-LanguageServer-Models-InitializeResult>-Handle>d__26.MoveNext () [0x00297] in <43976da1155b4e5492c57f3d85e24f0e>:0 \n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <cae080c8689e4af39d0ab2b313d012f5>:0 \n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <cae080c8689e4af39d0ab2b313d012f5>:0 \n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <cae080c8689e4af39d0ab2b313d012f5>:0 \n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <cae080c8689e4af39d0ab2b313d012f5>:0 \n at OmniSharp.Extensions.LanguageServer.LspRequestRouter+<RouteRequest>d__11.MoveNext () [0x00161] in <43976da1155b4e5492c57f3d85e24f0e>:0 ","type":1}}}]
Tue 19 Jun 2018 05:52:16 PM HKT:["<---",1,"omnisharp",{"response":{"protocolVersion":"2.0","id":"1","error":{"code":-32602,"message":"Internal Error"}},"request":{"method":"initialize","jsonrpc":"2.0","id":1,"params":{"rootUri":"file:///home/shihira/Program/Unity/Vitruvius/Assets/BuildMode/Scripts","initializationOptions":{},"capabilities":{"textDocument":{"completion":{"completionItem":{"snippetSupport":false}}}},"rootPath":"/home/shihira/Program/Unity/Vitruvius/Assets/BuildMode/Scripts","trace":"off"}}}]
I see a few similar errors in handling notification messages like textDocument/hover
& textDocument/completion
Editor: Monaco v0.13.0 Language client: monaco-languageclient v0.6.3 Omnisharp: v1.32.1 Mono: v5.10.1.47
console-window.ts:35 Monaco Client: Added handlers... waiting for initialize...
console-window.ts:35 Monaco Client: [dbug]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Finding descriptor for initialized
console-window.ts:35 Monaco Client: [dbug]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Finding descriptor for textDocument/didOpen
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Created attribute csharp::file:///Workspace/Solution/Solution.cs
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Looking for handler for method textDocument/didOpen
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Checking handler textDocument/didOpen:OmniSharp.LanguageServerProtocol.Handlers.TextDocumentSyncHandler
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Registration options OmniSharp.Extensions.LanguageServer.Models.TextDocumentRegistrationOptions
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Document Selector [**/*.cake]
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Checking handler textDocument/didOpen:OmniSharp.LanguageServerProtocol.Handlers.TextDocumentSyncHandler
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Registration options OmniSharp.Extensions.LanguageServer.Models.TextDocumentRegistrationOptions
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Document Selector [**/*.cs], [**/*.csx]
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Handler Selected: OmniSharp.LanguageServerProtocol.Handlers.TextDocumentSyncHandler via [**/*.cs], [**/*.csx] (targeting System.RuntimeType)
console-window.ts:35 Monaco Client: initialized...
console-window.ts:35 Monaco Client: [dbug]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Finding descriptor for textDocument/hover
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Found attributes 1, ::file:///Workspace/Solution/Solution.cs
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Looking for handler for method textDocument/hover
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Checking handler textDocument/hover:OmniSharp.LanguageServerProtocol.Handlers.HoverHandler
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Registration options OmniSharp.Extensions.LanguageServer.Models.TextDocumentRegistrationOptions
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Document Selector [**/*.cake]
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Checking handler textDocument/hover:OmniSharp.LanguageServerProtocol.Handlers.HoverHandler
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Registration options OmniSharp.Extensions.LanguageServer.Models.TextDocumentRegistrationOptions
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Document Selector [**/*.cs], [**/*.csx]
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Handler Selected: OmniSharp.LanguageServerProtocol.Handlers.HoverHandler via [**/*.cs], [**/*.csx] (targeting System.RuntimeType)
console-window.ts:35 Monaco Client: [dbug]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Finding descriptor for $/cancelRequest
console-window.ts:35 Monaco Client: [Error - 15:00:22] [crit]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Failed to handle notification textDocument/hover
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index
at Microsoft.CodeAnalysis.Text.SourceText+LineInfo.get_Item (System.Int32 index) [0x0000f] in <08991caaf2e34f1b8b9fd965f211ffe1>:0
at Microsoft.CodeAnalysis.Text.TextLineCollection.GetPosition (Microsoft.CodeAnalysis.Text.LinePosition position) [0x00008] in <08991caaf2e34f1b8b9fd965f211ffe1>:0
at OmniSharp.Roslyn.CSharp.Services.Types.TypeLookupService+<Handle>d__4.MoveNext () [0x00159] in <449ff3985fcb4f99af1ab8c8fb15a3bb>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0
at OmniSharp.LanguageServerProtocol.Handlers.HoverHandler+<Handle>d__6.MoveNext () [0x000cf] in <40a944db4757421299c6af3f45044be7>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0
at OmniSharp.Extensions.LanguageServer.LspRequestRouter+<RouteRequest>d__11.MoveNext () [0x00161] in <43976da1155b4e5492c57f3d85e24f0e>:0
console-window.ts:35 Monaco Client: [Error - 15:00:22] Request textDocument/hover failed.
console-window.ts:35 Monaco Client: Message: Internal Error
Code: -32602
[dbug]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Finding descriptor for textDocument/completion
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Found attributes 1, ::file:///Workspace/Solution/Solution.cs
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Looking for handler for method textDocument/completion
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Checking handler textDocument/completion:OmniSharp.LanguageServerProtocol.Handlers.CompletionHandler
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Registration options OmniSharp.Extensions.LanguageServer.Models.CompletionRegistrationOptions
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Document Selector [**/*.cake]
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Checking handler textDocument/completion:OmniSharp.LanguageServerProtocol.Handlers.CompletionHandler
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Registration options OmniSharp.Extensions.LanguageServer.Models.CompletionRegistrationOptions
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Document Selector [**/*.cs], [**/*.csx]
console-window.ts:35 Monaco Client: [trce]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Handler Selected: OmniSharp.LanguageServerProtocol.Handlers.CompletionHandler via [**/*.cs], [**/*.csx] (targeting System.RuntimeType)
console-window.ts:35 Monaco Client: [Error - 15:01:58] [crit]: OmniSharp.Extensions.LanguageServer.LspRequestRouter
Failed to handle notification textDocument/completion
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index
at Microsoft.CodeAnalysis.Text.SourceText+LineInfo.get_Item (System.Int32 index) [0x0000f] in <08991caaf2e34f1b8b9fd965f211ffe1>:0
at Microsoft.CodeAnalysis.Text.TextLineCollection.GetPosition (Microsoft.CodeAnalysis.Text.LinePosition position) [0x00008] in <08991caaf2e34f1b8b9fd965f211ffe1>:0
at OmniSharp.Roslyn.CSharp.Services.Intellisense.IntellisenseService+<Handle>d__3.MoveNext () [0x00124] in <449ff3985fcb4f99af1ab8c8fb15a3bb>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0
at OmniSharp.LanguageServerProtocol.Handlers.CompletionHandler+<Handle>d__7.MoveNext () [0x000dd] in <40a944db4757421299c6af3f45044be7>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0
at OmniSharp.Extensions.LanguageServer.LspRequestRouter+<RouteRequest>d__11.MoveNext () [0x00161] in <43976da1155b4e5492c57f3d85e24f0e>:0
console-window.ts:35 Monaco Client: [Error - 15:01:58] Request textDocument/completion failed.
console-window.ts:35 Monaco Client: Message: Internal Error
Code: -32602
@patilarpith, did you figure out the issue? I am seeing similar errors as well.
I guess it could be that the sln or csproj path is not set up correctly, but I am unable to fix these.
Anyone have an idea?
Thanks!
@hifall Highly doubt if the error is with project setup. I picked up HelloWorld project from the Omnisharp's test-assets folder for my testing.
Is there an editor plugin which uses omnisharp-roslyn in LSP mode? I've only seen plugins use the HTTP mode
@patilarpith, have you had any progress on this?
Does this System.ArgumentOutOfRangeException look like an omnisharp-roslyn issue?
I've been using omnisharp-node-client for awhile in order to get some form of LSP working with omnisharp. It's buggy, slow, but atleast it works some of the time. Would be nice to get it working through the omnisharp server itself
I believe most of the problems mentioned in this issue are caused by the out-dated csharp-language-server-protocol on Nuget. Therefore I hope you to merge the latest LSP library to omnisharp-roslyn, or at least make a new branch to work on this. After half a year I am so sad to see the software still refuses to work just because of some stupid negligence.
I modified multiple places in the codebase to try to make the LSP mode work properly. So far the LSP mode just basically works with LanguageClient-neovim, launched, at least, and did some completion for me. This took me most of the spare time in the last week studying the code.
-lsp
. It is easy to get it to work by commenting out some if-conditions in OmniSharp.Stdio.Driver/Program.cs
jsonrpc
, not protocolVersion
: Just search all ProtocolVersion
fields n the solution, and attach a [JsonProperty("jsonrpc")
attribute to them.
{..., "insertTextFormat": 0}
. This wouldn't be a problem in most cases. But for LanguageClient-neovim, it uses rust, which is a strong-typed language, and it verifies this field very strictly. Only 1 and 2 is valid for InsertTextFormat according to the lsp spec.
// CompletionListConverter.cs
foreach (var item in v.Items)
{
if (item.InsertTextFormat != InsertTextFormat.Snippet)
item.InsertTextFormat = InsertTextFormat.PlainText;
serializer.Serialize(writer, item);
}
To build omnisharp-roslyn with csharp-language-server-protocol, clone the two repos into the same directory, and checkout v0.7.0 of csharp-lsp. Now (un)comment some lines in OmniSharp.LanguageServerProtocol.csproj
:
<ItemGroup>
<!--<PackageReference Include="OmniSharp.Extensions.LanguageServerProtocol" Version="0.7.0" /> -->
<ProjectReference Include="../../../csharp-language-server-protocol/src/Lsp/Lsp.csproj" />
<ProjectReference Include="..\OmniSharp.Host\OmniSharp.Host.csproj" />
...
</ItemGroup>
Then we are done.
Is this issue still active? I am experiencing this issue in Neovim 0.5 using the built-in LSP framework. Here is my configuration (in Lua, since that is how it must be configured):
local exe = vim.fn.environ()['HOME']..'.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/OmniSharp.exe'
local nvim_lsp = require('nvim_lsp')
local nvim_lsp_defaults = require('nvim_lsp/configs')
if not nvim_lsp_defaults.omnisharp then
nvim_lsp_defaults.omnisharp = {
default_config = {
filetypes = {'cache', 'cs', 'csproj', 'dll', 'nuget', 'props', 'sln', 'targets'},
root_dir = nvim_lsp.util.root_pattern('.git', '.sln') or vim.loop.os_homedir(),
}
}
end
nvim_lsp.omnisharp.setup{
cmd = (vim.fn.has('win32') == 1) and {exe, '-lsp'} or {'mono', exe, '-lsp'}
}
Whenever I enter a .cs
file, the following message is sent:
LSP[id=1] client has shut down after sending the message
LSP[id=1] client has shut down after sending the message
(The message actually is output twice.)
Edit: I omitted settings that were irrelevant to the error's occurance.
Edit 2: This problem has been resolved by neovim/nvim-lsp#296
I don't know about neovim's built-in LSP framework. I do use neovim 0.4.3 with the ale
plugin and omnisharp-roslyn 1.35.3 just fine though. I made a pull-request for omnisharp support on ale
here: dense-analysis/ale#3190
Since you are getting a "client has shut down after sending the message" error, it seems to me like the LSP server isn't running at all. Is there any way you can get the stdout/stderr output for the child process that runs the LSP server? That would likely help you debug that issue.
@luizribeiro I am seeing that others are also having difficulty configuring OmniSharp-roslyn for Neovim's LSP framework, so I am beginning to believe it is an issue on that side of things. Thanks for the pointers! Hopefully the collective can get this one resolved.
I did find the reason. It's a "bug" on the root_pattern
function from the code. This method use the pattern to match the whole file name on the directory. So for a pattern like .csproj
will try to find a file with name .csproj
, not with a pattern like *.csproj
.
For now my workaround is to use like that:
root_dir = util.root_pattern("Makefile");
Just put a Makefile
there and life goes on.
A better approach is to make root_pattern
accept patterns, but I still didn't have time to create a solution.
Do you have any issues with the integration between omnisharp and nvim LSP or does it work perfectly?
On ale, I've been noticing that when I fix the last error on a file, omnisharp-roslyn
doesn't update the list of errors unless I do a :ALEReset
. I'm wondering if this has happened for you on nvim LSP too.
I am experiencing exactly what you describe. I thought it might be diagnostic-nvim
(a plugin to help provide better defaults for some of the LSP framework's settings) but since you are experiencing the same thing, I'm doubting that it's diagnostic-nvim
's issue.
Yes. This also occurs for me. I still don't understand why. Others language servers do work fine for this. Also notice with coc.nvim some time ago, but I don't use it anymore. I changed to use with nvim-lsp.
I think it's something on omnisharp's LSP server. Maybe it's not sending a message to the client when it should be or something similar.
The way to debug this would likely be to look at the messages that are exchanged between vim and the LSP server (and maybe compare it against a LSP server which you know doesn't have this issue). You can generally do this by replacing the LSP binary you are using on vim with a bash script that wraps around the omnisharp LSP server, but also writes the stdout/stderr/stdin to files that you can upload.
I'm probably not going to have time to debug this in the next few days, but I think this would be the way to go.
I have some time today so I'll give that a shot and report back.
Do you guys have msbuild
installed? I noticed when reading through some of the OmniSharp logs that it was trying to source that but couldn't on my machine. When I installed it, two things happened:
Also as promised I've attached results for three different contexts, which should hopefully help us here.
omnisharp-roslyn
running through Neovim LSP framework
#!/bin/bash
mono ~/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/OmniSharp.exe -v -lsp -z $@ | tee ~/omnisharp-log
omnisharp-roslyn
running through omnisharp-vim
sumneko_lua
running through Neovim LSP frameworkI will look over them in the coming days but I figured I'd upload them in the meantime.
Do you guys have msbuild installed?
Yes. All my configs for .NET are within this function for ZSH:
function dotnet-set-vars {
DOTNET_BASE=$(dotnet --info | grep "Base Path" | awk '{print $3}')
DOTNET_ROOT=$(echo $DOTNET_BASE | sed -E "s/^(.*)(\/sdk\/[^\/]+\/)$/\1/")
export MSBuildSDKsPath=${DOTNET_BASE}Sdks/
export DOTNET_ROOT=$DOTNET_ROOT
export PATH=$DOTNET_ROOT:$PATH
# dotnet tools dir
export PATH=~/.dotnet/tools:$PATH
}
It seems to not know about the assembly or what version of dotnet I'm using.
I notice this problem even with just one version installed. I'm using .NET Core 2.2.
Also as promised I've attached results for three different contexts, which should hopefully help us here.
Thanks. This will help.
From a quick look at the logs, it seems like textDocument/publishDiagnostics
is never sent by omnisharp
with diagnostics
being an empty dictionary (which would imply that all errors on the document have been fixed). sumneko
seems to do that.
Could that be the issue?
I'm not sure… sumenko_lua
only sends empty "diagnostics": []
once, the very first time that the textDocument/publishDiagnostics
method is sent. Other than that, omnisharp
and sumenko_lua
appear to both correctly send new diagnostics
that refresh the document (at least from my side). Getting msbuild
in my $PATH
seemed to cause that side of things to work.
However, omnisharp
does send erroneous error messages alongside every diagnostics
update, even the very first time (which you noticed as well). What's really curious to me is why omnisharp-vim
doesn't encounter the same issue— seemingly it is able to find the assembly information but Neovim's LSP is not.
If you're still having the issue with diagnostics not updating, can you verify msbuild
is in your path? I can consistently get this error to come back by removing msbuild
from my $PATH
.
I know @adelarsq also has msbuild
configured, and has the same issue with error messages/assembly detection. I'll be interested to see whether or not ALE has the same issue after we get it updating the diagnostics.
As for why my current error might be happening, I see this message:
An error occurred when attempting to access '/home/iron-e/Programming/ACTIVE/reef/~/.omnisharp/Roslynator/src/Core/bin/Debug/netstandard2.0/Roslynator.Core.dll'. - System.IO.DirectoryNotFoundException: Could not find a part of the path '/home/iron-e/Programming/ACTIVE/reef/~/.omnisharp/Roslynator/src/Core/bin/Debug/netstandard2.0/Roslynator.Core.dll'.
at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateDirectoryHandle (System.String path, System.Boolean ignoreNotFound) [0x00032] in <f9c140c086c44324a57f3d6c607e8e21>:0
at System.IO.Enumeration.FileSystemEnumerator`1[TResult]..ctor (System.String directory, System.IO.EnumerationOptions options) [0x00048] in <f9c140c086c44324a57f3d6c607e8e21>:0
at System.IO.Enumeration.FileSystemEnumerable`1+DelegateEnumerator[TResult]..ctor (System.IO.Enumeration.FileSystemEnumerable`1[TResult] enumerable) [0x00000] in <f9c140c086c44324a57f3d6c607e8e21>:0
at System.IO.Enumeration.FileSystemEnumerable`1[TResult]..ctor (System.String directory, System.IO.Enumeration.FileSystemEnumerable`1+FindTransform[TResult] transform, System.IO.EnumerationOptions options) [0x00042] in <f9c140c086c44324a57f3d6c607e8e21>:0
at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles (System.String directory, System.String expression, System.IO.EnumerationOptions options) [0x00014] in <f9c140c086c44324a57f3d6c607e8e21>:0
at System.IO.Directory.InternalEnumeratePaths (System.String path, System.String searchPattern, System.IO.SearchTarget searchTarget, System.IO.EnumerationOptions options) [0x0003c] in <f9c140c086c44324a57f3d6c607e8e21>:0
at System.IO.Directory.EnumerateFiles (System.String path, System.String searchPattern, System.IO.EnumerationOptions enumerationOptions) [0x00000] in <f9c140c086c44324a57f3d6c607e8e21>:0
at System.IO.Directory.EnumerateFiles (System.String path, System.String searchPattern) [0x00007] in <f9c140c086c44324a57f3d6c607e8e21>:0
at OmniSharp.Services.AssemblyLoader.LoadAllFrom (System.String folderPath) [0x00015] in <a3beccf5923c417282767eebc9bf25e1>:0
@adelarsq It looks like it's trying to find the dotnet version inside of the root_dir
instead of the home directory. Could this be the problem we are having with the erroneous error messages?
Appears that is trying to access two directories. Which environment variables do you have for .NET?
I only have one:
export PATH="$PATH":"$HOME/.dotnet/tools"
I use that for System.CommandLine
and System.CommandLine.DragonFruit
.
I have a roslyn extension in the folder ~/.omnisharp/…
as well.
These directories exists: /home/iron-e/Programming/ACTIVE/reef/
and ~/.omnisharp/Roslynator/src/Core/bin/Debug/netstandard2.0/Roslynator.Core.dll
.
For some reason the paths are been merged in one. So the path isn't valid.
I have a roslyn extension in the folder ~/.omnisharp/… as well.
Is this https://github.com/OmniSharp/omnisharp-vscode/issues/2369 related?
These directories exists:
/home/iron-e/Programming/ACTIVE/reef/
and~/.omnisharp/Roslynator/src/Core/bin/Debug/netstandard2.0/Roslynator.Core.dll
.For some reason the paths are been merged in one. So the path isn't valid.
Yeah. I notice that the first part of the path (/home/iron-e/…
) is always equal to the root_dir
, and I've tried this on a couple of other projects just to verify. It seems that now that the root_dir
is being correctly resolved, it is being used as the context for all paths rather than just some of them.
I have a roslyn extension in the folder ~/.omnisharp/… as well.
Is this OmniSharp/omnisharp-vscode#2369 related?
I don't think so… Roslynator has worked for me in VSCode and still works in coc.nvim
. Seems to be something the nvim_lsp
repo is mistakenly prepending.
If that's true, it would also explain why it can't find the netstandard
or core
.dll files— it'd be looking in root_dir
instead of the root of the filesystem.
Edit: I discovered a workaround.
I discovered my error before was a red herring because omnisharp-vim
also threw that error. I had to sift through it some more.
dotnet clean && dotnet build
from root_dir
.
omnisharp-vim
also had this problem sometimes, and I used to do this to fix it.If you're still having the issue with diagnostics not updating, can you verify msbuild is in your path? I can consistently get this error to come back by removing msbuild from my $PATH.
To be clear, the diagnostics update just fine for me - with the exception when I remove the very last error on the file. In those cases I need to restart the LSP.
I do have msbuild
in my path though.
I feel like we're mixing a few different issues on this issue. Should we split them into a few separate issues with more concise bug reports and close this one?
The version I use is the prebuilt binary package downloaded from github release page, v1.30.1 omnisharp-mono.tar.gz. linux-x86_64 package behaves exactly the same. Here is the relevant configurations in my .vimrc:
And here is the relevant log when error occurs:
I noticed the key "protocolVersion", which is usually "jsonrpc" in many other LSPs. Is it the reason why LanguageClient failed to deserialize it? Another problem causes the server crashing. I believe this is about what's been mentioned and solved in https://github.com/OmniSharp/csharp-language-server-protocol/issues/75. If that's true please merge them.
Thank you for your great work.