Comments (10)
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.
I restarted a few times, and the problem eventually stopped. Weird.
from vscode-csharp.
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.
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.
from vscode-csharp.
I get the errors even without the C# DevKit extension.
from vscode-csharp.
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.
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.
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.
@skyshaver You can downgrade to the previous version or you can use the workaround:
"dotnet.server.suppressLspErrorToasts": true
from vscode-csharp.
Related Issues (20)
- code-insiders crash when i click on create .net project HOT 1
- dotnet.exe infinite opening and closing HOT 1
- Debugger unable to attach to CoreCLR, error 0x80131c3c HOT 8
- Unable to hit breakpoint on macOS arm64 with .NET 9 preview 7 HOT 3
- Language server stops working after upgrade HOT 25
- Unable to attach to CoreCLR. Unknown Error: 0x80131c3c HOT 10
- .Net Aspire project exits debugging when MigrationService project ends HOT 2
- active debug config changes after .Net Aspire AppHost exits unexpectedly HOT 1
- Find-All-References results incomplete and unstable HOT 5
- [BUG] customRequest stackTrace does not return correct value HOT 4
- Opening File Diff in Source Control Crashes Microsoft.CodeAnalysis.LanguageServer HOT 2
- LanguageServerProjectSystem Error while loading ...csproj HOT 6
- Unable to get working directory for project Miscellaneous Files HOT 2
- Go to Definition (F12) doesn't work in decompiled source/assembly metadata HOT 1
- Use diff test explorer rendering on assert failures HOT 3
- NET Debugging is supported only in Microsoft versions of VS Code HOT 1
- Roslyn LSP isn't reporting CS8019 (Unused Usings) HOT 10
- Automatic quotes for attributes in Razor files HOT 2
- Microsoft.CodeAnalysis.LanguageServer client: couldn't create connection to server HOT 1
- Reloading extension - A element with id "<solution>" is already registered HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-csharp.