Roslyn: Error Activating the Razor Language Server After Editing Razor File and Moving to C# File

Created on 13 Nov 2020  路  6Comments  路  Source: dotnet/roslyn

image

  1. Edit Counter.razor
  2. Move to & edit in Program.cs

Expected: Normal editing
Actual: RZLS seems to have crashed

Note; repro doesn't happen 100% of the time.

System.InvalidOperationException: The language server has not yet shutdown.at Roslyn.Utilities.Contract.Fail(String message)at 
Microsoft.VisualStudio.LanguageServices.Implementation.LanguageClient.AbstractInProcLanguageClient.ActivateAsync(CancellationToken token)at Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageClientInstance.<InitializeAsync>d__83.MoveNext() --- End of stack trace from previous location where exception was thrown --- at 
Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageClientInstance.<InitializeAsync>d__83.MoveNext() --- End of stack trace from previous location where exception was thrown --- at 
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)at 
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)at 
Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageClientInstance.<OnRpcDisconnected>d__92.MoveNext() --- End of stack trace from previous location where exception was thrown --- at 
Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

[VS Main Local]
[30713.9]

Area-IDE Bug CloudEnv

Most helpful comment

@NTaylorMullen this is a dupe of https://github.com/dotnet/roslyn/issues/49329

All 6 comments

@dibarbet transferring this to Roslyn. There's a good chance this is an LSP platform issue but I don't see why they would be trying to re-activate either so I'm slightly suspect of Roslyn's pre-loading behavior.

@NTaylorMullen this is a dupe of https://github.com/dotnet/roslyn/issues/49329

Nevermind, @davidwengier is correct and this is not a dupe - my bad!

The LSP logs here will be useful - it looks we shutdown (either we get called to shutdown or we get a change we can't apply), then the client attempts to restart before we fully shutdown

ActivityLog

System.InvalidOperationException: The language server has not yet shutdown.at Roslyn.Utilities.Contract.Fail(String message)at 
Microsoft.VisualStudio.LanguageServices.Implementation.LanguageClient.AbstractInProcLanguageClient.ActivateAsync(CancellationToken token)at 
Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageClientInstance.<InitializeAsync>d__83.MoveNext() --- End of stack trace from previous location where exception was thrown --- at 
Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageClientInstance.<InitializeAsync>d__83.MoveNext() --- End of stack trace from previous location where exception was thrown --- at 
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)at 
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)at 
Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageClientInstance.<OnRpcDisconnected>d__92.MoveNext() --- End of stack trace from previous location where exception was thrown --- at 
Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)   

Razor C# Language Server Client 

Sent you the LSP logs.

https://github.com/dotnet/roslyn/issues/49528 causes the yellow bar.

The root cause of the shutdown is we're getting asked about non-generated-razor documents in an LSP server that only knows about generated razordocuments. This is supposed to be handled via client name we set on our server - the LSP client should only be asking our server about buffers that have a matching client.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JesperTreetop picture JesperTreetop  路  3Comments

binki picture binki  路  3Comments

MadsTorgersen picture MadsTorgersen  路  3Comments

AdamSpeight2008 picture AdamSpeight2008  路  3Comments

glennblock picture glennblock  路  3Comments