question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OmniSharp crashing - I think there must have been some update causing this issue.

See original GitHub issue

I 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:

  1. 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.
  2. 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:open
  • Created 3 years ago
  • Reactions:22
  • Comments:24 (1 by maintainers)

github_iconTop GitHub Comments

37reactions
vintzlcommented, Mar 17, 2021

Same here: Received response for /v2/getcodeactions but could not find request.

These bugs are very frustrating. Omnisharp is slowing becoming omnishit.

24reactions
williamdentoncommented, May 5, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot get code completion to work in Visual Studio Code ...
Code completion does not work (see first image). This is caused I think by OmniSharp not understanding the project (?) and crashing. I'm...
Read more >
Omnisharp silently crashes when working with docker
I think the problem is that this shared folder is different from the actual host (machine I'm running on) versus what is on...
Read more >
VSCode OmniSharp crashing on startup from UnityEngine ...
Registry Packages; Built-in Packages. Now OmniSharp starts without any errors and intellisense appears to be working correctly.
Read more >
Announcing .NET 6 Release Candidate 2
NET 6 RC2 has been tested and is supported with Visual Studio 2022 Preview ... It also includes an update on macOS and...
Read more >
Razor editor crashing (intellisense stops working, false ...
Warning: OmniSharp.Extensions.LanguageServer.Server.Configuration.DidChangeConfigurationProvider: No ConfigurationItems have been defined, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found