Skip to content

Conversation

@dibarbet
Copy link
Member

@dibarbet dibarbet commented Apr 1, 2023

Sometimes we're getting requested for codelens for cache entries that don't exist. This is not a full fix for the problem, but it does correct server behavior. Instead of crashing during the request context creation (which takes down the entire server), we'll throw an error in the actual handling of the request (which will not take down the entire server).

Actual fix for invalid requests TBD

This is related to AB#1778972, but doesn't fix entirely the issue (as mentioned above). But I kept running into the server crashing b/c of this today so I at least wanted to improve that part.

@dibarbet dibarbet added Area-IDE LSP issues related to the roslyn language server protocol implementation labels Apr 1, 2023
@dibarbet dibarbet requested a review from a team as a code owner April 1, 2023 00:27
@ghost ghost added the untriaged Issues and PRs which have not yet been triaged by a lead label Apr 1, 2023

public LSP.TextDocumentIdentifier GetTextDocumentIdentifier(LSP.CodeLens request)
=> GetCacheEntry(request).CacheEntry.TextDocumentIdentifier;
=> GetCodeLensResolveData(request).TextDocument;
Copy link
Member Author

@dibarbet dibarbet Apr 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the key line that changed - instead of reading from the cache entry (which in this error scenario doesn't exist) we read from the resolve data (which comes from the request itself). The request will still throw an error, but it will happen later when an error won't take down the whole queue.

@dibarbet dibarbet closed this Apr 2, 2023
auto-merge was automatically disabled April 2, 2023 21:52

Pull request was closed

@dibarbet dibarbet reopened this Apr 2, 2023
@dibarbet dibarbet merged commit ef5053b into dotnet:main Apr 2, 2023
@dibarbet dibarbet deleted the dont_crash_codelens branch April 2, 2023 21:52
@ghost ghost added this to the Next milestone Apr 2, 2023
@dibarbet dibarbet modified the milestones: Next, 17.7 P1 Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE LSP issues related to the roslyn language server protocol implementation untriaged Issues and PRs which have not yet been triaged by a lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants