dotnet / razor

Compiler and tooling experience for Razor ASP.NET Core apps in Visual Studio, Visual Studio for Mac, and VS Code.
https://asp.net
MIT License
474 stars 185 forks source link

c# devkit pops up several "request textdocument/definition failed." #9840

Open rrelyea opened 5 months ago

rrelyea commented 5 months ago

Version Used: C# dev kit 1.2.7

Steps to Reproduce:

  1. clone https://github.com/bogle-tools/site
  2. open in vscode with C# dev kit 1.2.7 installed (appears to be latest update published) - but this has been happening for months
  3. edit some c# files and razor files...and eventually you'll see a bunch of 'request textdocument/definition failed." message popups image

click on "go to output:" and this is in output window: [Error - 8:52:54 AM] [LanguageServerHost] System.ArgumentOutOfRangeException: The requested line number 3485 must be less than the number of lines 2210. (Parameter 'Line') at Microsoft.CodeAnalysis.Text.TextLineCollection.GetPosition(LinePosition position) in //src/Compilers/Core/Portable/Text/TextLineCollection.cs:line 67 at Microsoft.CodeAnalysis.LanguageServer.Extensions.GetPositionFromLinePositionAsync(TextDocument document, LinePosition linePosition, CancellationToken cancellationToken) in //src/Features/LanguageServer/Protocol/Extensions/Extensions.cs:line 173 at Microsoft.CodeAnalysis.LanguageServer.Handler.AbstractGoToDefinitionHandler.GetDefinitionAsync(TextDocumentPositionParams request, Boolean typeOnly, RequestContext context, CancellationToken cancellationToken) in //src/Features/LanguageServer/Protocol/Handler/Definitions/AbstractGoToDefinitionHandler.cs:line 141 at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in //src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 189

Expected Behavior: Less useless prompts

Actual Behavior: 3-4 useless prompts often when working on my project.

CyrusNajmabadi commented 5 months ago

@davidwengier is it possible the file is being regenerated, but the lsp messages are not getting ordered properly wrt to them?

mzaprudin commented 2 weeks ago

I have the same issue