OmniSharp crashing - I think there must have been some update causing this issue.
See original GitHub issueI think there must have been a bug in some of the recent updates causing the following issue. Since two days OmniSharp behaves very strange. It occurs randomly, but often. After I edit my code:
- Syntax highlighting gets broken, parts of the code stay in default color, sometimes even half a word stay highlighted correctly and the rest loses resets to default color.
- Problems panel lists many extra errors that are just a fiction. I have to run
dotnet build
in the terminal to find the true errors.
For example, I changed a declaration of a HashSet<Shape>
to a List<Shape>
. The following error appeared: The type or namespace name 'HistashSet<>' could not be found (are you missing a using directive or an assembly reference?)
and it stays being shown even after half an hour. Some issue must have occurred while I was typing and the code is not re-analyzed anymore. Further fictitious errors occur everywhere I use the respective variable. The syntax highlighting around the edited spot is broken.
The previous example affected just a small portion of the code within just one file. Yesterday I managed to get several hundreds of fictious errors and whole files with over 1k lines all red. It’s impossible to work this way 😢
The following debug information contains also an exception that massively occurs in the OmniSharp log. It is an ArgumentOutOfRange
at Microsoft.CodeAnalysis.Text.LinePosition..ctor (System.Int32 line, System.Int32 character) [0x00013] in <74e762f007514b0991a005183ec8dcb2>:0
Environment data
.NET Core SDK (reflecting any global.json):
Version: 3.1.404
Commit: 470f6754b3
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.404/
Host (useful for support):
Version: 3.1.10
Commit: 1721e39439
.NET Core SDKs installed:
3.1.404 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.10 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
C# Extension version:
1.23.5
OmniSharp log
Starting OmniSharp server at 11/11/2020, 10:07:02 PM
Target: xxx.sln
OmniSharp server started.
Path: /home/xxx/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/run
PID: 7984
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on ubuntu 20.4 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.8.0 - "/home/xxx/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/home/xxx/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.8.0 - "/home/xxx/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /home/xxx/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin
CscToolPath = /home/xxx/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /home/xxx/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/home/xxx'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
Detecting projects in '/home/xxx/xxx.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
...
[fail]: OmniSharp.Stdio.Host
************ Response ************
{
"Request_seq": 15,
"Command": "/v2/highlight",
"Running": true,
"Success": false,
"Message": "\"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.\\nParameter name: character\\n at Microsoft.CodeAnalysis.Text.LinePosition..ctor (System.Int32 line, System.Int32 character) [0x00013] in <74e762f007514b0991a005183ec8dcb2>:0 \\n at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.Handle (OmniSharp.Models.SemanticHighlight.SemanticHighlightRequest request) [0x00146] in <8ca5e445b15640a0986680e5a0180b25>:0 \\n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler`2[TRequest,TResponse][] handlers, TRequest request) [0x00099] in <9e06207949b04d41ac60c7c691c8ecbb>:0 \\n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in <9e06207949b04d41ac60c7c691c8ecbb>:0 \\n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in <9e06207949b04d41ac60c7c691c8ecbb>:0 \\n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000e7] in <add5f40a6e784fcca3e930b59965388b>:0 \"",
"Body": null,
"Seq": 121,
"Type": "response"
}
[fail]: OmniSharp.Stdio.Host
//This exception repeats many many times.
Steps to reproduce
Unknown, happens randomly at code edits.
Expected behavior
Syntax highlighting should work and there should be no fictitious errors.
Actual behavior
Syntax highlighting broken and plenty of fictitious errors appear.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:22
- Comments:24 (1 by maintainers)
Top GitHub Comments
Same here:
Received response for /v2/getcodeactions but could not find request.
These bugs are very frustrating. Omnisharp is slowing becoming omnishit.
I’ve found a possible cause - the project i was working on was not in the sln file, vscode doesn’t care so much about sln, but when there is one, and it’s missing a project, omnisharp appears to be busted.