-
Notifications
You must be signed in to change notification settings - Fork 199
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
Language service won't start sometimes #10021
Comments
Thanks for your report @Peter-Juhasz. Could please you give us a bit more info to help us dig deeper?
Your answers will really help us get to the bottom of this. Thanks for your patience! |
Hi @maryamariyan, Yes, it still does, usually when I first open a Razor file. Maybe larger files with ~500 lines are more prone to trigger the issue. But I can't reproduce it consistently. Reopening the file usually solves it. The project type is Blazor Web Assembly with ~200 .razor pages/components (which is referenced by an ASP.NET Core project - with a few Razor files). The next time I encounter this issue I will check the logs again and send it over. But even with a clean run today morning (start VS, open Razor file) when Razor LS did start successfully, I can see some errors in the log: [CLaSP] [09:53:16.9870107] [null]: System.InvalidOperationException: Start: (686,37) matches or exceeds SourceText boundary 637.
at Microsoft.AspNetCore.Razor.ThrowHelper.ThrowInvalidOperationException[T](String message)
at Microsoft.CodeAnalysis.Text.SourceTextExtensions.<GetTextSpan>g__GetAbsoluteIndex|24_0(SourceText text, Int32 line, Int32 character, String name)
at Microsoft.CodeAnalysis.Text.SourceTextExtensions.GetTextSpan(SourceText text, Int32 startLine, Int32 startCharacter, Int32 endLine, Int32 endCharacter)
at Microsoft.VisualStudio.LanguageServer.Protocol.VsLspExtensions.GetTextSpan(SourceText text, Range range)
at Microsoft.CodeAnalysis.Razor.Diagnostics.RazorTranslateDiagnosticsService.InCSharpLiteral(Diagnostic d, SourceText sourceText, RazorSyntaxTree syntaxTree)
at Microsoft.CodeAnalysis.Razor.Diagnostics.RazorTranslateDiagnosticsService.<>c__DisplayClass6_0.<FilterHTMLDiagnostics>b__0(Diagnostic d)
at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.CodeAnalysis.Razor.Diagnostics.RazorTranslateDiagnosticsService.<TranslateAsync>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Razor.LanguageServer.Diagnostics.DocumentPullDiagnosticsEndpoint.<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()
I'm not sure they are related, I can move this to another issue if this is unrelated. |
@maryamariyan this is a demo from today morning: 20250118-0829-41.3585393.mp4It is very strange, because:
Logs (although I had only Error level logs enabled):
|
Thanks for all the info you've shared @Peter-Juhasz, it's super helpful! It look like we might have a bug to track down in the Razor language server. On our end we're gonna try to replicate the issue and identify what's causing it. The intermittent nature of it makes it a bit tricky, but your notes are a great starting point. In the meantime, there are a few things you could try that may help with some of the troubles you're experiencing and could help us understand the bug better as we work on this:
If any of these steps make a difference, do let us know. It'll help us understand the bug better. |
This was the first try (note outlining worked this time, but Razor components were not recognized): Second try the same as usual: The very strange thing is that after around a whole minute, while writing this comment in another window, the list of completions popped over the window finally from VS: But it still didn't start, every new attempt takes like a minute to show up. Neither errors/squiggles go away, only after around a minute: |
VS 17.10.0 P1
No outlining, no code completion. Although syntax highlighting and quick info seems to be working.
No logs in Razor logger output.
Reopening the file usually solves the issue. (The file was not copy-pasted.)
The text was updated successfully, but these errors were encountered: