Skip to content

Conversation

@DustinCampbell
Copy link

The RoslynLanguageServer in the latest Microsoft.CodeAnalysis.LanguageServer.Protocol.dll doesn't exit gracefully when the JsonRpc it's listening to is forcibly disconnected. Unfortunately, that's exactly how our CSharpTestLspServer shuts down the RoslynLanguageServer that it creates. Ultimately, the Razor EA should be updated to provide a IAsyncDisposable implementation that can be called to gracefully shut down the language server. However, in the meantime, this change uses reflection to get at the underlying RoslynLanguageServer and call ShutdownAsync and ExitAsync on it before disposing the server-side JsonRpc.

The RoslynLanguageServer in the latest Microsoft.CodeAnalysis.LanguageServer.Protocol.dll doesn't exit gracefully when the JsonRpc it's listening to is forcibly disconnected. Unfortunately, that's exactly how our CSharpTestLspServer shuts down the RoslynLanguageServer that it creates. Ultimately, the Razor EA should be updated to provide a IAsyncDisposable implementation that can be called to gracefully shut down the language server. However, in the meantime, this change uses reflection to get at the underlying RoslynLanguageServer and call ShutdownAsync and ExitAsync on it before disposing the server-side JsonRpc.
@ryzngard ryzngard merged commit c1c975c into ryzngard:consume_new_ea Apr 10, 2025
@DustinCampbell DustinCampbell deleted the fix-csharptestlanguageserver branch April 10, 2025 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants