Closed frarees closed 4 years ago
Possibly a previous request in progress. Apart from that error message, is anything going wrong? Does the server restart correctly as expected?
Possibly a previous request in progress
With debug mode enabled, I waited for everything to finish, then triggered the restart.
Does the server restart correctly as expected?
It looks like, yes. Although I didn't make specific tests e.g. remove a class from the project/sln > restart > try to look up type.
I think I've seen the error message before but it doesn't happen for me in regular restart situations (which I do daily, as a result of working in solutions depending on other solutions). I'll keep an eye out and see if I can repro.
@frarees I haven't been able to reproduce this, but I think I see where it might be happening.
Would you be able to check whether this change removes the error for you?
It's still happening. If there's something I can test on my side, let me know.
Can you see the error in :messages
output? If so, can you post the full error (if there's more than in the issue title)? Or perhaps take a screenshot?
Is it also being written to the :OmniSharpOpenLog
log?
@frarees I tried something else, could you try this version?
Messages maintainer: Bram Moolenaar <Bram@vim.org>
"~/Desktop/test/Assets/NewBehaviourScript.cs" 18L, 305C
"Assets/NewBehaviourScript.cs" line 1 of 18 --5%-- col 1
Loaded server for /Users/frarees/Desktop/test/test.sln in 2.8s
channel 0 closed: '<feff>'
Loaded server for /Users/frarees/Desktop/test/test.sln in 2.6s
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 12 2020 00:47:07), macOS version
OmniSharp server started.
Path: /Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/run
Target: /Users/frarees/Desktop/test/test.sln
PID: 14534
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on MacOS 10.15.6 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.8.0 - "/Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.8.0 - "/Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin
CscToolPath = /Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/.msbuild
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/Users/frarees/Desktop/test'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
Detecting projects in '/Users/frarees/Desktop/test/test.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/Users/frarees/Desktop/test/Assembly-CSharp.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/Users/frarees/Desktop/test'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /Users/frarees/Desktop/test/Assembly-CSharp.csproj
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/Users/frarees/Desktop/test' on host -1.
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/Users/frarees/Desktop/test/Assembly-CSharp.csproj'.
All projects loaded
[info]: OmniSharp.MSBuild.ProjectManager
Adding project '/Users/frarees/Desktop/test/Assembly-CSharp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Update project: Assembly-CSharp
[fail]: OmniSharp.MSBuild.ProjectLoadListener
Unexpected exception got thrown from project load listener: System.NullReferenceException: Object reference not set to an instance of an object
at OmniSharp.MSBuild.ProjectLoadListener.GetSdkVersion (OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs args) [0x0000b] in <7e6cb753aca94549b693616e0e7d1016>:0
at OmniSharp.MSBuild.ProjectLoadListener.ProjectLoaded (OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs args) [0x0001a] in <7e6cb753aca94549b693616e0e7d1016>:0
Workspace complete: 1 project(s)
Replaying on-load requests
This one
[fail]: OmniSharp.MSBuild.ProjectLoadListener
Unexpected exception got thrown from project load listener: System.NullReferenceException: Object reference not set to an instance of an object
at OmniSharp.MSBuild.ProjectLoadListener.GetSdkVersion (OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs args) [0x0000b] in <7e6cb753aca94549b693616e0e7d1016>:0
at OmniSharp.MSBuild.ProjectLoadListener.ProjectLoaded (OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs args) [0x0001a] in <7e6cb753aca94549b693616e0e7d1016>:0
Looks like https://github.com/OmniSharp/omnisharp-vim/issues/631#issuecomment-692352187
Did you try the latest version? I pushed it 40 minutes ago.
Yes. Logs where after that second update.
Hmm. OK, frustrating. This only seems to happen on macOS, there are a couple of other old issues where people have got "channel 0 closed" errors. I don't want to keep taking shots in the dark, without being able to repro the error myself.
If I were to find anything related to this, I'll let you know.
I have a feeling this might have to do with BOM?
In Unity, the C# script template is marked with BOM, so some of my files have these characters at the beginning of the file (<U+FEFF>
). I have converted my .cs
files with dos2unix
just in case. Still no luck, I'm still getting channel 0 closed: '<feff>'
. Maybe some other files (e.g. .sln
, .csproj
, something in omnisharp-vim?) have the BOM and a routine fails when going through those?
Interesting, I don't know Unity files were marked with a BOM. We already look for and remove the BOM in server responses, here and here.
Hmm. Looking at that file though, it looks like the neovim and vim error handlers are different. In the neovim handler we also check for a response which is just the BOM. In the vim error handler we don't. Perhaps try adding a check for a BOM there?
No success either. But, I've started to investigate, since I can repro it, and I traced it back here.
Any ideas why job_stop
fails with channel 0 closed: '<feff>'
?
No, no idea. But wrapping that line in a try/catch should be a safe enough fix.
Tried this:
try
call job_stop(job.job_id)
catch /.*/
echo "Caught error: " . v:exception
endtry
But it seems it's not going through the catch
.
More insights.
Fails in MacVim:
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 12 2020 00:47:07)
macOS version
Included patches: 1-539
Fails in macOS bundled vi:
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 5 2020 21:30:37)
macOS version
Included patches: 1-503, 505-680, 682-2292
It doesn't fail in Neovim:
NVIM v0.4.4
Build type: Release
LuaJIT 2.0.5
Could you please try altering the OmniSharp#proc#vimErrHandler
function like this:
function! OmniSharp#proc#vimErrHandler(channel, message) abort
if ch_status(a:channel) ==# 'closed'
echomsg 'Message received after channel closed: ' . a:message
return
endif
let message = printf('%s: %s', string(a:channel), string(a:message))
call OmniSharp#util#EchoErr(message)
endfunction
Also, is the message you currently see in your messages being highlighted, or just normal text?
It works. It seems it's getting highlighted, although I get focus back to my buffer.
OK, I'll remove the extra debugging message and push an update.
Fixed?
No longer prevents restarting, so I’d say it is 👍. Thanks!
Thanks very much for helping debug this.
When I issue a
:OmniSharpRestartServer
command, I getchannel 0 closed: '<feff>'
.MacVim 8.2.539 (163) OmniSharp-Roslyn v1.37.1