Skip to content

[VS Code] Diff view fails with "Request textDocument/inlayHint failed." #8595

@aaronpowell

Description

@aaronpowell

Going through the process of reviewing this PR and when I open a razor file, such as EventList.razor, I get an error notification in VS Code Request textDocument/inlayHint failed..

Opening the Razor log I see this:

[Info  - 2:43:49 AM] [CLaSP] Using default language handler for textDocument/inlayHint: 
[Info  - 2:43:49 AM] [CLaSP] [StartContext] textDocument/inlayHint
[Error - 2:43:49 AM] [CLaSP] [null]: 
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'End (55,97) matches or exceeds SourceText boundary 50.')
   at Microsoft.CodeAnalysis.Razor.Workspaces.SourceTextExtensions.<GetTextSpan>g__GetAbsoluteIndex|11_0(Int32 line, Int32 character, SourceText sourceText, String argName) in /_/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs:line 287
   at Microsoft.CodeAnalysis.Razor.Workspaces.SourceTextExtensions.GetTextSpan(SourceText sourceText, Int32 startLine, Int32 startCharacter, Int32 endLine, Int32 endCharacter) in /_/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs:line 273
   at Microsoft.CodeAnalysis.Razor.Workspaces.RazorCodeDocumentExtensions.TryGetMinimalCSharpRange(RazorCodeDocument codeDocument, LinePositionSpan razorRange, LinePositionSpan& csharpRange) in /_/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorCodeDocumentExtensions.cs:line 97
   at Microsoft.AspNetCore.Razor.LanguageServer.InlayHints.InlayHintService.GetInlayHintsAsync(IClientConnection clientConnection, VersionedDocumentContext documentContext, Range range, CancellationToken cancellationToken) in /_/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/InlayHintService.cs:line 35
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, IMethodHandler handler, CancellationToken cancellationToken)
[Error - 2:43:49 AM] Request textDocument/inlayHint failed.
  Message: Specified argument was out of the range of valid values. (Parameter 'End (55,97) matches or exceeds SourceText boundary 50.')
  Code: -32004 
[object Object]
[Info  - 2:43:49 AM] [CLaSP] [EndContext] textDocument/inlayHint
[Info  - 2:43:49 AM] [CLaSP] Using default language handler for textDocument/inlayHint: 
[Info  - 2:43:49 AM] [CLaSP] [StartContext] textDocument/inlayHint
[Client - 2:43:50 AM] (Warning) razor/inlayHint failed with Error: Range={ Start={ Line=93, Character=37 }, End={ Line=749, Character=18 } }. text.Length=7819. text.Lines.Count=197
[Info  - 2:43:50 AM] [CLaSP] [EndContext] textDocument/inlayHint
[Info  - 2:43:50 AM] [CLaSP] Using default language handler for textDocument/semanticTokens/range: 
[Info  - 2:43:50 AM] [CLaSP] [StartContext] textDocument/semanticTokens/range
[Error - 2:43:50 AM] [CLaSP] [null]: 
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'End (25,97) matches or exceeds SourceText boundary 50.')
   at Microsoft.CodeAnalysis.Razor.Workspaces.SourceTextExtensions.<GetTextSpan>g__GetAbsoluteIndex|11_0(Int32 line, Int32 character, SourceText sourceText, String argName) in /_/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs:line 287
   at Microsoft.CodeAnalysis.Razor.Workspaces.SourceTextExtensions.GetTextSpan(SourceText sourceText, Int32 startLine, Int32 startCharacter, Int32 endLine, Int32 endCharacter) in /_/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs:line 273
   at Microsoft.CodeAnalysis.Razor.Workspaces.LinePositionSpanExtensions.ToTextSpan(LinePositionSpan linePositionSpan, SourceText sourceText) in /_/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionSpanExtensions.cs:line 18
   at Microsoft.CodeAnalysis.Razor.SemanticTokens.AbstractRazorSemanticTokensInfoService.GetSemanticTokensAsync(VersionedDocumentContext documentContext, LinePositionSpan span, Guid correlationId, Boolean colorBackground, CancellationToken cancellationToken) in /_/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs:line 71
   at Microsoft.CodeAnalysis.Razor.SemanticTokens.AbstractRazorSemanticTokensInfoService.GetSemanticTokensAsync(VersionedDocumentContext documentContext, LinePositionSpan span, Boolean colorBackground, Guid correlationId, CancellationToken cancellationToken) in /_/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs:line 45
   at Microsoft.AspNetCore.Razor.LanguageServer.Semantic.SemanticTokensRangeEndpoint.HandleRequestAsync(SemanticTokensRangeParams request, RazorRequestContext requestContext, CancellationToken cancellationToken) in /_/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/SemanticTokensRangeEndpoint.cs:line 54
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, IMethodHandler handler, CancellationToken cancellationToken)
[Error - 2:43:50 AM] Request textDocument/semanticTokens/range failed.
  Message: Specified argument was out of the range of valid values. (Parameter 'End (25,97) matches or exceeds SourceText boundary 50.')
  Code: -32004 
[object Object]
[Info  - 2:43:50 AM] [CLaSP] [EndContext] textDocument/semanticTokens/range
[Info  - 2:43:50 AM] [CLaSP] Using default language handler for textDocument/semanticTokens/range: 
[Info  - 2:43:50 AM] [CLaSP] [StartContext] textDocument/semanticTokens/range
[Warn  - 2:43:50 AM] [LSP][LanguageServer.Semantic.LSPCSharpSemanticTokensProvider] Didn't get C# tokens because the virtual document wasn't found, or other problem. We were wanting 1 but C# could not get any version.
[Info  - 2:43:50 AM] [LSP][LanguageServer.Semantic.RazorSemanticTokensInfoService] Returned no semantic tokens for span (0,0)-(25,72) in review:/workspaces/azure-openai-service-proxy/src/AzureOpenAIProxy.Management/Components/Pages/EventList.razor?{"path"%3A"src%2FAzureOpenAIProxy.Management%2FComponents%2FPages%2FEventList.razor"%2C"commit"%3A"ede091de7317424f844c3563d786c9aae50738f4"%2C"base"%3Atrue%2C"isOutdated"%3Afalse%2C"rootPath"%3A"%2Fworkspaces%2Fazure-openai-service-proxy"}.
[Info  - 2:43:50 AM] [CLaSP] [EndContext] textDocument/semanticTokens/range
[Info  - 2:46:22 AM] [LSP][LanguageServer.ProjectConfigurationStateSynchronizer] Configuration file removed for project 'ProjectKey { IsUnknown = False, Id = /workspaces/azure-openai-service-proxy/src/AzureOpenAIProxy.Management/obj/Debug/net8.0/ }'.
[Info  - 2:46:22 AM] [LSP][LanguageServer.ProjectConfigurationStateSynchronizer] Configuration file added for project '/workspaces/azure-openai-service-proxy/src/AzureOpenAIProxy.Management/obj/Debug/net8.0/'.
[Info  - 2:46:23 AM] [LSP][LanguageServer.ProjectConfigurationStateSynchronizer] Updating /workspaces/azure-openai-service-proxy/src/AzureOpenAIProxy.Management/obj/Debug/net8.0/.
[Info  - 2:46:23 AM] [LSP][LanguageServer.ProjectSystem.RazorProjectService] Updating project 'ProjectKey { IsUnknown = False, Id = /workspaces/azure-openai-service-proxy/src/AzureOpenAIProxy.Management/obj/Debug/net8.0/ }' TagHelpers (1217) and C# Language Version (CSharp12).

This is an example of what the screen looks like when the error appears:

image

Every scroll action results in a new version of the error.

Environment

  • VS Code Insiders
    Version: 1.90.0-insider (user setup)
    Commit: ca688da9fb6dad00996cee7d5342490daa7bb1fb
    Date: 2024-05-31T01:05:41.342Z
    Electron: 29.4.0
    ElectronBuildId: 9593362
    Chromium: 122.0.6261.156
    Node.js: 20.9.0
    V8: 12.2.281.27-electron.0
    OS: Windows_NT x64 10.0.26120
    
  • C# extension: v2.31.19
  • C# DevKit: v1.6.8
  • OS: opened in a devcontainer

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions