Fix URI comparisons for different casing #74746
Merged
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 https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2208409
Issue was caused by #74544
Prior to my change, absolute URIs would ignore case when comparing UNC URIs (default impl of
Uri.GetHashCode
. However once I manually started comparing AbsolutePaths, case was never ignored (due to the hashcode being different for upper vs lower case strings).This showed up as an issue in C# DevKit because files in the workspace get added with an upper case drive letter (by devkit project system). But VSCode sends LSP requests always with a lower case drive letter. We'd end up always ignoring the diagnostics requests because we thought the file was not tracked by LSP.
This did not show up as an issue in the C# extension because we populate the workspace there with lower case drive letters (what vscode gives us).
The change here is to use an ignoring case hashcode for absolute path. This will potentially cause collisions if a path exists with both cases, but that is generally rare. We will fallback to the URI implementation of comparison in
Equals
, which appropriately handles case depending on the kind of URI.