Skip to content

Syntax highlighting got into broken state, won't recover #11889

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

Open
Peter-Juhasz opened this issue May 25, 2025 · 0 comments
Open

Syntax highlighting got into broken state, won't recover #11889

Peter-Juhasz opened this issue May 25, 2025 · 0 comments

Comments

@Peter-Juhasz
Copy link

VS 17.14.2 P1

20250525-1828-05.6169503.mp4

Error log is many errors:

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.                   Parameter name: span                      at Microsoft.CodeAnalysis.Text.SubText..ctor(SourceText text, TextSpan span)                      at Microsoft.CodeAnalysis.Text.SubText.GetSubText(TextSpan span)                      at Microsoft.CodeAnalysis.Text.CompositeText.RemoveSplitLineBreaksAndEmptySegments(ArrayBuilder`1 segments)                      at Microsoft.CodeAnalysis.Text.CompositeText.ToSourceText(ArrayBuilder`1 segments, SourceText original, Boolean adjustSegments)                      at Microsoft.CodeAnalysis.Text.SourceText.WithChanges(IEnumerable`1 changes)                      at Microsoft.CodeAnalysis.Text.ChangedText.WithChanges(IEnumerable`1 changes)                      at Microsoft.AspNetCore.Razor.LanguageServer.DocumentSynchronization.DocumentDidChangeEndpoint.ApplyContentChanges(IEnumerable`1 contentChanges, SourceText sourceText)                      at Microsoft.AspNetCore.Razor.LanguageServer.DocumentSynchronization.DocumentDidChangeEndpoint.<HandleNotificationAsync>d__7.MoveNext()                   --- End of stack trace from previous location where exception was thrown ---                      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()                      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)                      at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.<StartRequestAsync>d__17`2.MoveNext()                   --- End of stack trace from previous location where exception was thrown ---                      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()                      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)                      at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.<StartRequestAsync>d__17`2.MoveNext()                   --- End of stack trace from previous location where exception was thrown ---                      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()                      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)                      at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.<ProcessQueueCoreAsync>d__18`2.MoveNext()                   --- End of stack trace from previous location where exception was thrown ---                      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()                      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)                      at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.<InvokeProcessCoreAsync>d__17.MoveNext()                   --- End of stack trace from previous location where exception was thrown ---                      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()                      at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.<ProcessQueueAsync>d__16.MoveNext()
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.                   Parameter name: span                      at Microsoft.CodeAnalysis.Text.SubText..ctor(SourceText text, TextSpan span)                      at Microsoft.CodeAnalysis.Text.SubText.GetSubText(TextSpan span)                      at Microsoft.CodeAnalysis.Text.CompositeText.RemoveSplitLineBreaksAndEmptySegments(ArrayBuilder`1 segments)                      at Microsoft.CodeAnalysis.Text.CompositeText.ToSourceText(ArrayBuilder`1 segments, SourceText original, Boolean adjustSegments)                      at Microsoft.CodeAnalysis.Text.SourceText.WithChanges(IEnumerable`1 changes)                      at Microsoft.CodeAnalysis.Text.ChangedText.WithChanges(IEnumerable`1 changes)                      at Microsoft.AspNetCore.Razor.LanguageServer.DocumentSynchronization.DocumentDidChangeEndpoint.ApplyContentChanges(IEnumerable`1 contentChanges, SourceText sourceText)                      at Microsoft.AspNetCore.Razor.LanguageServer.DocumentSynchronization.DocumentDidChangeEndpoint.<HandleNotificationAsync>d__7.MoveNext()                   --- End of stack trace from previous location where exception was thrown ---                      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()                      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)                      at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.<StartRequestAsync>d__17`2.MoveNext()
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.                   Parameter name: character                      at Microsoft.CodeAnalysis.Text.LinePosition..ctor(Int32 line, Int32 character)                      at Microsoft.CodeAnalysis.Text.TextLineCollection.GetLinePosition(Int32 position)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNodeExtensions.GetSourceSpan(SyntaxNode node, RazorSourceDocument source)                      at Microsoft.AspNetCore.Razor.Language.RazorHtmlWriter.WriteToken(SyntaxToken token)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.Visit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.DefaultVisit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.RazorHtmlWriter.WriteNode[TNode](TNode node, Boolean isHtml, Action`1 handler)                      at Microsoft.AspNetCore.Razor.Language.RazorHtmlWriter.VisitMarkupTextLiteral(MarkupTextLiteralSyntax node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.Visit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.DefaultVisit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.Visit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.DefaultVisit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.Visit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.DefaultVisit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.Visit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.DefaultVisit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.Visit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.DefaultVisit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.Visit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.DefaultVisit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.Visit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.DefaultVisit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.Visit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.DefaultVisit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.Visit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.DefaultVisit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.Visit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.DefaultVisit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker.Visit(SyntaxNode node)                      at Microsoft.AspNetCore.Razor.Language.RazorHtmlWriter.Visit(RazorSyntaxTree syntaxTree)                      at Microsoft.AspNetCore.Razor.Language.RazorHtmlWriter.GetHtmlDocument(RazorCodeDocument codeDocument)                      at Microsoft.AspNetCore.Razor.Language.RazorCodeDocumentExtensions.GetHtmlDocument(RazorCodeDocument codeDocument)                      at Microsoft.CodeAnalysis.Razor.DocumentMapping.IDocumentMappingServiceExtensions.GetPositionInfo(IDocumentMappingService service, RazorCodeDocument codeDocument, Int32 hostDocumentIndex)                      at Microsoft.AspNetCore.Razor.LanguageServer.Completion.Delegation.DelegatedCompletionListProvider.GetCompletionListAsync(RazorCodeDocument codeDocument, Int32 absoluteIndex, VSInternalCompletionContext completionContext, DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, RazorCompletionOptions razorCompletionOptions, Guid correlationId, CancellationToken cancellationToken)                      at Microsoft.AspNetCore.Razor.LanguageServer.Completion.CompletionListProvider.<GetCompletionListCoreAsync>d__5.MoveNext()                   --- End of stack trace from previous location where exception was thrown ---                      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()                      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)                      at Microsoft.AspNetCore.Razor.LanguageServer.Completion.RazorCompletionEndpoint.<HandleRequestAsync>d__10.MoveNext()                   --- End of stack trace from previous location where exception was thrown ---                      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()                      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)                      at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.<StartRequestAsync>d__17`2.MoveNext()
Error thrown while retrieving CSharp semantic range.                   System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.                   Parameter name: character                      at Microsoft.CodeAnalysis.Text.LinePosition..ctor(Int32 line, Int32 character)                      at Microsoft.CodeAnalysis.Text.TextLineCollection.GetLinePosition(Int32 position)                      at Microsoft.CodeAnalysis.Razor.DocumentMapping.AbstractDocumentMappingService.TryMapToHostDocumentPosition(IRazorGeneratedDocument generatedDocument, Int32 generatedDocumentIndex, LinePosition& hostDocumentPosition, Int32& hostDocumentIndex)                      at Microsoft.CodeAnalysis.Razor.DocumentMapping.AbstractDocumentMappingService.TryMapToHostDocumentRangeStrict(IRazorGeneratedDocument generatedDocument, LinePositionSpan generatedDocumentRange, LinePositionSpan& hostDocumentRange)                      at Microsoft.CodeAnalysis.Razor.DocumentMapping.AbstractDocumentMappingService.TryMapToHostDocumentRange(IRazorGeneratedDocument generatedDocument, LinePositionSpan generatedDocumentRange, MappingBehavior mappingBehavior, LinePositionSpan& hostDocumentRange)                      at Microsoft.CodeAnalysis.Razor.SemanticTokens.AbstractRazorSemanticTokensInfoService.<GetCSharpSemanticRangesAsync>d__10.MoveNext()                   --- End of stack trace from previous location where exception was thrown ---                      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()                      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)                      at Microsoft.CodeAnalysis.Razor.SemanticTokens.AbstractRazorSemanticTokensInfoService.<GetSemanticTokensAsync>d__8.MoveNext()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant