Fix Windows-only LSP errors: URI %3A decoding and quoted .rsp lines#886
Merged
Conversation
…885) Two Windows-specific bugs prevented the language server from resolving projects and references correctly: 1. DocumentUri.GetFileSystemPath() did not strip the leading '/' from paths produced by Uri.LocalPath when VS Code sends percent-encoded drive-letter colons (file:///c%3A/...). This produced /c:/... which Path.GetFullPath mangled into C:\c:\..., breaking all file-to-project lookups. 2. ParseReferencesFromResponseFile skipped lines where MSBuild wraps the entire switch in quotes (e.g. "/r:C:\Program Files\..."), which is the standard format for paths containing spaces on Windows. This silently dropped all core .NET framework references.
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.
Fixes #885
Two Windows-specific bugs prevented the language server from resolving projects and references correctly:
Bug 1 - URI %3A decoding (src/LanguageServer/Protocol/Models.cs): VS Code sends percent-encoded drive-letter colons (file:///c%3A/...). Uri.LocalPath decoded %3A but kept a leading /, producing /c:/Users/... which Path.GetFullPath mangled into C:\c:\Users.... This broke all file-to-project lookups - every file compiled standalone without cross-file awareness.
Bug 2 - Quoted .rsp lines (src/LanguageServer/ProjectDiscovery.cs): MSBuild on Windows wraps entire switches in quotes when paths contain spaces. The parser only recognized lines starting with / or -, silently dropping all core .NET framework references. For the Oahu E2E test project, only 15 of 182 references were loaded.
Both bugs are Windows-specific (macOS has no drive letters and no Program Files paths).
Verification: