Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
I get these errors sometimes when editting Razor files in C#
2026-05-25 14:32:27.924 [info] [Error - 2:32:27 PM] [textDocument/inlayHint] [LanguageServerHost] System.ArgumentException: Range={ Start={ Line=12, Character=0 }, End={ Line=104, Character=0 } }. text.Length=2930. text.Lines.Count=100
---> System.ArgumentOutOfRangeException: The requested line number 104 must be less than the number of lines 100. (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.CalculateInlayHintsAsync(Document document, Range range, InlineHintsOptions options, Boolean displayAllOverride, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs:line 100
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.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
2026-05-25 14:32:27.924 [error] Error making textDocument/inlayHint request Range={ Start={ Line=12, Character=0 }, End={ Line=104, Character=0 } }. text.Length=2930. text.Lines.Count=100
2026-05-25 14:32:27.980 [info] [Error - 2:32:27 PM] [textDocument/semanticTokens/range] [LanguageServerHost] System.ArgumentOutOfRangeException: The requested line number 104 must be less than the number of lines 100. (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)
at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensHelpers.HandleRequestHelperAsync(Document document, ImmutableArray`1 spans, Boolean supportsVisualStudioExtensions, ClassificationOptions options, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:line 71
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 49
at Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensRangeHandler.HandleRequestAsync(SemanticTokensRangeParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs:line 37
at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
2026-05-25 14:32:27.980 [info] [Error - 2:32:27 PM] Request textDocument/semanticTokens/range failed.
2026-05-25 14:32:27.980 [info] Message: The requested line number 104 must be less than the number of lines 100. (Parameter 'Line')
Code: -32000
[object Object]
Steps to Reproduce
It typically happens when i’m working with razor code which is not default html. For instance i have some classes called HoloPanel and if i do an error occurs
Operating System
Windows 10/11
Version Information
Version: 3.5.17 (user setup)
VSCode Version: 1.105.1
Commit: d5b2fc092e16007956c9e5047f76097b9e626ca0
Date: 2026-05-20T02:43:31.559Z
Layout: editor
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.22631
Additional Information
Identifier
anysphere.csharp
Version
1.0.1
Last Updated
2025-12-06, 13:18:15
Does this stop you from using Cursor
No - Cursor works, but with this issue