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 ArgumentOutOfRangeException in Semantic Highlighting

See original GitHub issue

Issue Type: Bug

I get the below error in the OmniSharp log after opening a Unity 2019.4.17f1 project. Tested with 1.23.8 and 1.23.7, both the same. Restarting OmniSharp and VSCode doesn’t change the behavior.

[fail]: OmniSharp.Stdio.Host
        ************  Response ************ 
{
  "Request_seq": 59,
  "Command": "/v2/highlight",
  "Running": true,
  "Success": false,
  "Message": "\"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.\\r\\nParameter name: line\\r\\n   at Microsoft.CodeAnalysis.Text.LinePosition..ctor(Int32 line, Int32 character)\\r\\n   at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.<Handle>d__1.MoveNext() in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\SemanticHighlight\\\\SemanticHighlightService.cs:line 36\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at OmniSharp.Endpoint.EndpointHandler`2.<GetFirstNotEmptyResponseFromHandlers>d__19.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at OmniSharp.Endpoint.EndpointHandler`2.<HandleRequestForLanguage>d__20.MoveNext() in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Host\\\\Endpoint\\\\EndpointHandler.cs:line 230\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at OmniSharp.Endpoint.EndpointHandler`2.<Process>d__16.MoveNext() in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Host\\\\Endpoint\\\\EndpointHandler.cs:line 131\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at OmniSharp.Stdio.Host.<HandleRequest>d__13.MoveNext() in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Stdio\\\\Host.cs:line 215\"",
  "Body": null,
  "Seq": 137,
  "Type": "response"
}

Extension version: 1.23.8 VS Code version: Code 1.52.1 (ea3859d4ba2f3e577a159bc91e3074c5d85c0523, 2020-12-16T16:34:46.910Z) OS version: Windows_NT x64 10.0.18362

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:13
  • Comments:19 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vchirikovcommented, Jan 5, 2021

are you able to share a project that consistently reproduces this? I would like to be able to pin it down There were no OmniSharp server changes to semantic highlighting since 1.34.15 😄 but perhaps something else is causing this

@filipw repro: https://github.com/vchirikov/limiter file LimiterTests.cs

ms-dotnettools.csharp-1.23.8 omnisharp 1.37.6-beta.16

[fail]: OmniSharp.Stdio.Host
        ************  Response ************ 
{
  "Request_seq": 60,
  "Command": "/v2/highlight",
  "Running": true,
  "Success": false,
  "Message": "\"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.\\r\\nParameter name: line\\r\\n   at Microsoft.CodeAnalysis.Text.LinePosition..ctor(Int32 line, Int32 character)\\r\\n   at OmniSharp.Roslyn.CSharp.Services.SemanticHighlight.SemanticHighlightService.<Handle>d__1.MoveNext() in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\SemanticHighlight\\\\SemanticHighlightService.cs:line 36\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at OmniSharp.Endpoint.EndpointHandler`2.<GetFirstNotEmptyResponseFromHandlers>d__19.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at OmniSharp.Endpoint.EndpointHandler`2.<HandleRequestForLanguage>d__20.MoveNext() in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Host\\\\Endpoint\\\\EndpointHandler.cs:line 230\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at OmniSharp.Endpoint.EndpointHandler`2.<Process>d__16.MoveNext() in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Host\\\\Endpoint\\\\EndpointHandler.cs:line 131\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n   at OmniSharp.Stdio.Host.<HandleRequest>d__13.MoveNext() in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Stdio\\\\Host.cs:line 215\"",
  "Body": null,
  "Seq": 59,
  "Type": "response"
}
1reaction
jannickjcommented, Jan 5, 2021

anyone knows about a omnisharp version that’s not broken I can switch to? edit: "omnisharp.path": "1.37.2-beta.105" seems to work.

the error is transient, caused by a corrupt state between the editor and server, a restart should fix it.

there were no changes to semantic highlighting in OmniSharp in several months. As I linked, possible cause is #4088 but that’s just my guess

I’ve restarted multple times + switching back to the newest re-breakes it (and it requires a restart to switch), so either a corrupt file is cached somewhere on my pc or it’s something else.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Semantic highlighting in OmniSharp and C# extension for VS ...
The semantic highlighting is an exciting feature that improves the quality of syntax highlighting when working with C# in VS Code. I encourage ......
Read more >
C# semantic highlighting in VS Code - Stack Overflow
I am trying to utilize new feature from VS Code to highlight C# code using new semantics. While code itself was highlighted successfully, ......
Read more >
VS2022 总是提示“Feature 'Document higlights' is currently ...
ArgumentOutOfRangeException : Specified argument was out of the range of valid values. ... HandleNonSuccessAndDebuggerNotification(Task task) at OmniSharp.
Read more >
omnisharp-vscode - Discover .NET
Official C# support for Visual Studio Code (powered by OmniSharp) ... Great C# editing support, including Syntax Highlighting, IntelliSense, ...
Read more >
facebook Code Example - Code Grepper
... Syntax Error: Error: PostCSS plugin tailwindcss requires PostCSS 8. ... sdp library android · rvm is not a function selecting rubies with...
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