You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a new unsaved file and update the language to C# in VSCode
Save the file somewhere in the workspace
At step 2, sometimes the language server will crash with
"message": "[LanguageServerHost] System.InvalidOperationException: Unable to determine language for 'untitled:Untitled-1' with LSP language id ''\r\n at Microsoft.CodeAnalysis.LanguageServer.LanguageInfoProvider.GetLanguageInformation(Uri uri, String lspLanguageId) in /_/src/LanguageServer/Protocol/LanguageInfoProvider.cs:line 70\r\n at Microsoft.CodeAnalysis.LanguageServer.RoslynLanguageServer.GetLanguageForRequest(String methodName, Object serializedParameters) in /_/src/LanguageServer/Protocol/RoslynLanguageServer.cs:line 169\r\n at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.ProcessQueueAsync()"
Looking at the logs from when this happened, before the exception is thrown, we get a didClose for the same document
Requests for the unsaved document before the didClose succeed. The issue appears to be that sometimes there are requests in flight for the unsaved document that get processed after the didClose is handled by the server. In didClose, we remove the open document state (which maps the document to the language for it) - https://github.com/dotnet/roslyn/blob/main/src/LanguageServer/Protocol/Handler/DocumentChanges/DidCloseHandler.cs#L36. After we've removed the document state we are no longer able to map the URI to a language (it has no extension).
We should likely stop throwing if we cannot find the language, and use a default value (and log a warning). We cannot hold onto the open document state after didClose - we'll just leak documents.
The text was updated successfully, but these errors were encountered:
To repro
At step 2, sometimes the language server will crash with
Looking at the logs from when this happened, before the exception is thrown, we get a didClose for the same document
Requests for the unsaved document before the didClose succeed. The issue appears to be that sometimes there are requests in flight for the unsaved document that get processed after the didClose is handled by the server. In didClose, we remove the open document state (which maps the document to the language for it) - https://github.com/dotnet/roslyn/blob/main/src/LanguageServer/Protocol/Handler/DocumentChanges/DidCloseHandler.cs#L36. After we've removed the document state we are no longer able to map the URI to a language (it has no extension).
We should likely stop throwing if we cannot find the language, and use a default value (and log a warning). We cannot hold onto the open document state after didClose - we'll just leak documents.
The text was updated successfully, but these errors were encountered: