Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix URI comparisons for different casing #74746

Merged
merged 2 commits into from
Aug 13, 2024
Merged

Conversation

dibarbet
Copy link
Member

@dibarbet dibarbet commented Aug 13, 2024

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.

@dibarbet dibarbet requested a review from a team as a code owner August 13, 2024 19:42
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 13, 2024
@dibarbet dibarbet merged commit a187b89 into dotnet:main Aug 13, 2024
25 checks passed
@dibarbet dibarbet deleted the fix_uris_again branch August 13, 2024 21:08
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Aug 13, 2024
@dibarbet dibarbet modified the milestones: Next, 17.12 P2 Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants