Do not crash if URI not parseable and no default handler exists#83024
Merged
dibarbet merged 1 commit intodotnet:mainfrom Apr 2, 2026
Merged
Do not crash if URI not parseable and no default handler exists#83024dibarbet merged 1 commit intodotnet:mainfrom
dibarbet merged 1 commit intodotnet:mainfrom
Conversation
jasonmalinowski
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves dotnet/vscode-csharp#9130
This does not completely fix the errors, but it prevents the server from crashing. The root cause of the errors is an invalid URI (see dotnet/vscode-csharp#9087).
Scenario
When a request to the server is made for an unparsable URI and we have no saved language information sent to use via
didOpen, the server falls back to trying to find a handler for the method using the default language.However, some handlers have no default language handler, for example Razor's
textDocument/documentColorhandler. If we are unable to determine the language for a request for this method, the server would crash as it finds no default language handler.Fix
The fix I made here is to not crash the server if we cannot find a handler for a request. The client still gets an error, but allows server operations to continue. This seemed appropriate as we do not control the client(s) and should not completely die if we get bad requests.
Microsoft Reviewers: Open in CodeFlow