Git Product home page Git Product logo

Comments (10)

Raevenn avatar Raevenn commented on August 20, 2024 1

Same problem here, reverting to version 2.30.28 seems to be a temporary solution until a new update fixes the issue.
Extensions > c# > right-click on extension > "Install Another Version" > select "2.30.28" from dropdown.

The original error seems to appear more when also using C# Dev Kit extension, though this is not yet confirmed.

from vscode-csharp.

lonix1 avatar lonix1 commented on August 20, 2024

I restarted a few times, and the problem eventually stopped. Weird.

from vscode-csharp.

lonix1 avatar lonix1 commented on August 20, 2024

It's back. I can get three popups one on top of the other:

Request textDocument/definition failed.

Request textDocument/documentHighlight failed.

Request textDocument/hover failed.

The errors are all different, but it's obviously the same root problem. Only started in latest version.

[Error - 7:13:41 AM] [LanguageServerHost] System.ArgumentException: Range={ Start={ Line=150, Character=261 }, End={ Line=932, Character=7 } }. text.Length=54132. text.Lines.Count=892
 ---> System.ArgumentOutOfRangeException: The requested line number 932 must be less than the number of lines 892. (Parameter 'Line')
   at Microsoft.CodeAnalysis.Text.TextLineCollection.GetPosition(LinePosition position) in /_/src/Compilers/Core/Portable/Text/TextLineCollection.cs:line 67
   at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in /_/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 330
   --- End of inner exception stack trace ---
   at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in /_/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 335
   at Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint.InlayHintHandler.HandleRequestAsync(InlayHintParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs:line 45
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, IMethodHandler handler, CancellationToken cancellationToken)
Error making textDocument/inlayHint request: Range={ Start={ Line=150, Character=261 }, End={ Line=932, Character=7 } }. text.Length=54132. text.Lines.Count=892

[Error - 7:13:41 AM] [LanguageServerHost] System.ArgumentOutOfRangeException: The requested line number 932 must be less than the number of lines 892. (Parameter 'Line')
   at Microsoft.CodeAnalysis.Text.TextLineCollection.GetPosition(LinePosition position) in /_/src/Compilers/Core/Portable/Text/TextLineCollection.cs:line 67
   at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.ComputeSemanticTokensDataAsync(Document document, ImmutableArray`1 spans, Boolean supportsVisualStudioExtensions, ClassificationOptions options, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 103
   at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.HandleRequestHelperAsync(Document document, ImmutableArray`1 spans, Boolean supportsVisualStudioExtensions, ClassificationOptions options, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 67
   at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.HandleRequestHelperAsync(IGlobalOptionService globalOptions, SemanticTokensRefreshQueue semanticTokensRefreshQueue, Range[] ranges, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 46
   at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensRangeHandler.HandleRequestAsync(SemanticTokensRangeParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs:line 44
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, IMethodHandler handler, CancellationToken cancellationToken)

[Error - 7:13:41 AM] Request textDocument/semanticTokens/range failed.
  Message: The requested line number 932 must be less than the number of lines 892. (Parameter 'Line')
  Code: -32000
[object Object]

[Error - 7:13:42 AM] [LanguageServerHost] System.ArgumentException: Range={ Start={ Line=150, Character=261 }, End={ Line=932, Character=7 } }. text.Length=54132. text.Lines.Count=892
 ---> System.ArgumentOutOfRangeException: The requested line number 932 must be less than the number of lines 892. (Parameter 'Line')
   at Microsoft.CodeAnalysis.Text.TextLineCollection.GetPosition(LinePosition position) in /_/src/Compilers/Core/Portable/Text/TextLineCollection.cs:line 67
   at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in /_/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 330
   --- End of inner exception stack trace ---
   at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in /_/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 335
   at Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint.InlayHintHandler.HandleRequestAsync(InlayHintParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs:line 45
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, IMethodHandler handler, CancellationToken cancellationToken)
Error making textDocument/inlayHint request: Range={ Start={ Line=150, Character=261 }, End={ Line=932, Character=7 } }. text.Length=54132. text.Lines.Count=892
[Error - 7:13:42 AM] [LanguageServerHost] System.ArgumentOutOfRangeException: The requested line number 932 must be less than the number of lines 892. (Parameter 'Line')
   at Microsoft.CodeAnalysis.Text.TextLineCollection.GetPosition(LinePosition position) in /_/src/Compilers/Core/Portable/Text/TextLineCollection.cs:line 67
   at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.ComputeSemanticTokensDataAsync(Document document, ImmutableArray`1 spans, Boolean supportsVisualStudioExtensions, ClassificationOptions options, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 103
   at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.HandleRequestHelperAsync(Document document, ImmutableArray`1 spans, Boolean supportsVisualStudioExtensions, ClassificationOptions options, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 67
   at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.HandleRequestHelperAsync(IGlobalOptionService globalOptions, SemanticTokensRefreshQueue semanticTokensRefreshQueue, Range[] ranges, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 46
   at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensRangeHandler.HandleRequestAsync(SemanticTokensRangeParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs:line 44
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, IMethodHandler handler, CancellationToken cancellationToken)
[Error - 7:13:42 AM] Request textDocument/semanticTokens/range failed.
  Message: The requested line number 932 must be less than the number of lines 892. (Parameter 'Line')
  Code: -32000
[object Object]
[Error - 7:13:42 AM] [LanguageServerHost] System.ArgumentException: Range={ Start={ Line=150, Character=261 }, End={ Line=932, Character=7 } }. text.Length=54132. text.Lines.Count=892
 ---> System.ArgumentOutOfRangeException: The requested line number 932 must be less than the number of lines 892. (Parameter 'Line')
   at Microsoft.CodeAnalysis.Text.TextLineCollection.GetPosition(LinePosition position) in /_/src/Compilers/Core/Portable/Text/TextLineCollection.cs:line 67
   at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in /_/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 330
   --- End of inner exception stack trace ---
   at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in /_/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 335
   at Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint.InlayHintHandler.HandleRequestAsync(InlayHintParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs:line 45
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, IMethodHandler handler, CancellationToken cancellationToken)
Error making textDocument/inlayHint request: Range={ Start={ Line=150, Character=261 }, End={ Line=932, Character=7 } }. text.Length=54132. text.Lines.Count=892
[Error - 7:13:42 AM] [LanguageServerHost] System.ArgumentOutOfRangeException: The requested line number 932 must be less than the number of lines 892. (Parameter 'Line')
   at Microsoft.CodeAnalysis.Text.TextLineCollection.GetPosition(LinePosition position) in /_/src/Compilers/Core/Portable/Text/TextLineCollection.cs:line 67
   at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.ComputeSemanticTokensDataAsync(Document document, ImmutableArray`1 spans, Boolean supportsVisualStudioExtensions, ClassificationOptions options, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 103
   at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.HandleRequestHelperAsync(Document document, ImmutableArray`1 spans, Boolean supportsVisualStudioExtensions, ClassificationOptions options, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 67
   at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.HandleRequestHelperAsync(IGlobalOptionService globalOptions, SemanticTokensRefreshQueue semanticTokensRefreshQueue, Range[] ranges, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 46
   at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensRangeHandler.HandleRequestAsync(SemanticTokensRangeParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs:line 44
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, IMethodHandler handler, CancellationToken cancellationToken)
[Error - 7:13:42 AM] Request textDocument/semanticTokens/range failed.
  Message: The requested line number 932 must be less than the number of lines 892. (Parameter 'Line')
  Code: -32000
[object Object]

from vscode-csharp.

mairaw avatar mairaw commented on August 20, 2024

I get the same error when working on the project for the dot.net website.
I can open the project normally and I usually get this error once I start working in one of the .cshtml pages.

VS Code team, you can get the source at https://github.com/dotnet/website.

from vscode-csharp.

timheuer avatar timheuer commented on August 20, 2024

@phil-allen-msft

from vscode-csharp.

lonix1 avatar lonix1 commented on August 20, 2024

I get the errors even without the C# DevKit extension.

from vscode-csharp.

skyshaver avatar skyshaver commented on August 20, 2024

I found at least a temporary solution, manually cleaning everything out of of build/obj and rebuilding. It seems the c# ext relies on a bunch of files in there and things like changing file names cause it all sorts of confusion. I still have to restart the language server every once in a while but I managed to get some work done yesterday. On Friday it was basically unusable

from vscode-csharp.

phil-allen-msft avatar phil-allen-msft commented on August 20, 2024

We're sorry you are running into this. We are working on this class of issue, but in the meantime another user reported this as a potential way to get behavior more like what you may expect: microsoft/vscode-dotnettools#722 (comment)

from vscode-csharp.

skyshaver avatar skyshaver commented on August 20, 2024

My temporary solution no longer works, this morning my vs code environment is again very broken. Walls of red/yellow squiggles on working code that weren't there yesterday. After a bit I start getting the pop-ups from the language server again. It makes it very difficult to work

from vscode-csharp.

lonix1 avatar lonix1 commented on August 20, 2024

@skyshaver You can downgrade to the previous version or you can use the workaround:

"dotnet.server.suppressLspErrorToasts": true

from vscode-csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.