Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unrecognized Controls and Error message "Request textDocument/semanticTokens/range failed" #1622

Open
nsteve-one opened this issue Nov 19, 2024 · 0 comments
Assignees
Labels

Comments

@nsteve-one
Copy link

nsteve-one commented Nov 19, 2024

Describe the Issue

When importing a large Blazor controls library (50+ controls) into a .NET Blazor MAUI Hybrid app, Visual Studio Code may only recognize some controls while marking others with a yellow underline indicating "Found markup with unexpected name" even though these controls should be found because the project is imported and properly referenced. Opening affected .razor files triggers a "Request textDocument/semanticTokens/range failed" error.

The same code can be opened in Rider and Visual Studio without these issues

Despite these IDE issues, the project can still be built and run successfully.

Click to view logs 2024-11-19 13:32:34.048 [info] Using dotnet configured on PATH 2024-11-19 13:32:34.048 [info] Dotnet path: /usr/local/share/dotnet/dotnet 2024-11-19 13:32:34.049 [info] Activating C# + C# Dev Kit... 2024-11-19 13:32:34.851 [info] [stdout] {"pipeName":"/var/folders/f2/n8h37r9x0lzgnv4s54dth1sdr_n20c/T/3cffba49.sock"}

2024-11-19 13:32:34.851 [info] received named pipe information from server
2024-11-19 13:32:34.851 [info] client has connected to server
2024-11-19 13:32:34.904 [info] [Info - 1:32:34 PM] [Program] Language server initialized
2024-11-19 13:32:37.711 [info] [Info - 1:32:37 PM] [WorkspaceProjectFactoryService] Project /Users/nstevens/Dev_Home/Dev_Library/Blazor/Blazor_Controls/Blazor_Controls.csproj loaded by C# Dev Kit
2024-11-19 13:32:42.152 [info] [Info - 1:32:42 PM] [WorkspaceProjectFactoryService] Project /Users/nstevens/Dev_Home/ScaleSuiteMobile/ScaleSuiteMobile/ScaleSuiteMobile.csproj loaded by C# Dev Kit
2024-11-19 13:32:42.155 [info] [Info - 1:32:42 PM] [WorkspaceProjectFactoryService] Project /Users/nstevens/Dev_Home/ScaleSuiteMobile/ScaleSuiteMobile/ScaleSuiteMobile.csproj loaded by C# Dev Kit
2024-11-19 13:32:42.157 [info] [Info - 1:32:42 PM] [WorkspaceProjectFactoryService] Project /Users/nstevens/Dev_Home/ScaleSuiteMobile/ScaleSuiteMobile/ScaleSuiteMobile.csproj loaded by C# Dev Kit
2024-11-19 13:42:48.417 [info] [Error - 1:42:48 PM] [LanguageServerHost] System.ArgumentException: Range={ Start={ Line=56, Character=44 }, End={ Line=439, Character=0 } }. text.Length=10383. text.Lines.Count=254
---> System.ArgumentOutOfRangeException: The requested line number 439 must be less than the number of lines 254. (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/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 306
--- End of inner exception stack trace ---
at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in //src/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 311
at Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint.InlayHintHandler.GetInlayHintsAsync(Document document, TextDocumentIdentifier textDocumentIdentifier, Range range, InlineHintsOptions options, Boolean displayAllOverride, InlayHintCache inlayHintCache, CancellationToken cancellationToken) in /
/src/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs:line 53
at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken) 2024-11-19 13:42:48.420 [error] Error making textDocument/inlayHint request Range={ Start={ Line=56, Character=44 }, End={ Line=439, Character=0 } }. text.Length=10383. text.Lines.Count=254 2024-11-19 13:42:48.886 [info] [Error - 1:42:48 PM] [LanguageServerHost] System.ArgumentOutOfRangeException: The requested line number 439 must be less than the number of lines 254. (Parameter 'Line') at Microsoft.CodeAnalysis.Text.TextLineCollection.GetPosition(LinePosition position) in /_/src/Compilers/Core/Portable/Text/TextLineCollection.cs:line 67 at Microsoft.CodeAnalysis.Text.TextLineCollection.GetTextSpan(LinePositionSpan span) in /_/src/Compilers/Core/Portable/Text/TextLineCollection.cs:line 78 at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.ComputeSemanticTokensDataAsync(Document document, ImmutableArray1 spans, Boolean supportsVisualStudioExtensions, ClassificationOptions options, CancellationToken cancellationToken) in //src/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 105
at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.HandleRequestHelperAsync(Document document, ImmutableArray1 spans, Boolean supportsVisualStudioExtensions, ClassificationOptions options, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 69 at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.HandleRequestHelperAsync(IGlobalOptionService globalOptions, SemanticTokensRefreshQueue semanticTokensRefreshQueue, Range[] ranges, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 48 at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensRangeHandler.HandleRequestAsync(SemanticTokensRangeParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs:line 44 at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
2024-11-19 13:42:48.887 [info] [Error - 1:42:48 PM] Request textDocument/semanticTokens/range failed.
2024-11-19 13:42:48.887 [info] Message: The requested line number 439 must be less than the number of lines 254. (Parameter 'Line')
Code: -32000
[object Object]
2024-11-19 13:47:23.276 [info] [Error - 1:47:23 PM] [LanguageServerHost] System.ArgumentException: Range={ Start={ Line=56, Character=44 }, End={ Line=439, Character=0 } }. text.Length=10383. text.Lines.Count=254
---> System.ArgumentOutOfRangeException: The requested line number 439 must be less than the number of lines 254. (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/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 306
--- End of inner exception stack trace ---
at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in /
/src/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 311
at Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint.InlayHintHandler.GetInlayHintsAsync(Document document, TextDocumentIdentifier textDocumentIdentifier, Range range, InlineHintsOptions options, Boolean displayAllOverride, InlayHintCache inlayHintCache, CancellationToken cancellationToken) in //src/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs:line 53
at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken) 2024-11-19 13:47:23.278 [error] Error making textDocument/inlayHint request Range={ Start={ Line=56, Character=44 }, End={ Line=439, Character=0 } }. text.Length=10383. text.Lines.Count=254 2024-11-19 13:47:23.286 [info] [Error - 1:47:23 PM] [LanguageServerHost] System.ArgumentException: Range={ Start={ Line=56, Character=44 }, End={ Line=439, Character=0 } }. text.Length=10383. text.Lines.Count=254 ---> System.ArgumentOutOfRangeException: The requested line number 439 must be less than the number of lines 254. (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/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 306 --- End of inner exception stack trace --- at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in /_/src/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 311 at Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint.InlayHintHandler.GetInlayHintsAsync(Document document, TextDocumentIdentifier textDocumentIdentifier, Range range, InlineHintsOptions options, Boolean displayAllOverride, InlayHintCache inlayHintCache, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs:line 53 at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
2024-11-19 13:47:23.287 [error] Error making textDocument/inlayHint request Range={ Start={ Line=56, Character=44 }, End={ Line=439, Character=0 } }. text.Length=10383. text.Lines.Count=254
2024-11-19 13:47:23.323 [info] [Error - 1:47:23 PM] [LanguageServerHost] System.ArgumentException: Range={ Start={ Line=56, Character=44 }, End={ Line=439, Character=0 } }. text.Length=10383. text.Lines.Count=254
---> System.ArgumentOutOfRangeException: The requested line number 439 must be less than the number of lines 254. (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/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 306
--- End of inner exception stack trace ---
at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in /
/src/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 311
at Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint.InlayHintHandler.GetInlayHintsAsync(Document document, TextDocumentIdentifier textDocumentIdentifier, Range range, InlineHintsOptions options, Boolean displayAllOverride, InlayHintCache inlayHintCache, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs:line 53
at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken) 2024-11-19 13:47:23.323 [error] Error making textDocument/inlayHint request Range={ Start={ Line=56, Character=44 }, End={ Line=439, Character=0 } }. text.Length=10383. text.Lines.Count=254 2024-11-19 13:47:23.351 [info] [Error - 1:47:23 PM] [LanguageServerHost] System.ArgumentException: Range={ Start={ Line=56, Character=44 }, End={ Line=439, Character=0 } }. text.Length=10383. text.Lines.Count=254 ---> System.ArgumentOutOfRangeException: The requested line number 439 must be less than the number of lines 254. (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/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 306 --- End of inner exception stack trace --- at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.RangeToTextSpan(Range range, SourceText text) in /_/src/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 311 at Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint.InlayHintHandler.GetInlayHintsAsync(Document document, TextDocumentIdentifier textDocumentIdentifier, Range range, InlineHintsOptions options, Boolean displayAllOverride, InlayHintCache inlayHintCache, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs:line 53 at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)

Had to trim logs due to length

Steps To Reproduce

  1. Create a new NET Blazor MAUI Project from template
  2. Reference and Import project with lots of Blazor Controls
  3. Add several controls to a page

Expected Behavior

All controls are identified properly by VS code and I am able to go into any of their definitions.

Environment Information

OS: MacOS 15.0.1
VS Code: 1.95.3 (Universal)
C# Extension: 2.55.29
C# Dev Kit: 1.13.9
.NET MAUI: 1.4.36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants