From b6e30c72c79b99823170dfe43771beab7adc8d1b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Feb 2026 15:55:42 +0000 Subject: [PATCH 1/2] Initial plan From b53c9f7c538f6efe910fd413524bdb8b4cc87db0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Feb 2026 16:28:31 +0000 Subject: [PATCH 2/2] Fix Uri.GetHashCode to use OrdinalIgnoreCase for all file: URIs, not just IsUncOrDosPath Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com> --- src/libraries/System.Private.Uri/src/System/Uri.cs | 2 +- .../tests/FunctionalTests/UriMethodsTests.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Private.Uri/src/System/Uri.cs b/src/libraries/System.Private.Uri/src/System/Uri.cs index d1d27484e82f76..5418d8d0d5e449 100644 --- a/src/libraries/System.Private.Uri/src/System/Uri.cs +++ b/src/libraries/System.Private.Uri/src/System/Uri.cs @@ -1545,7 +1545,7 @@ public override int GetHashCode() string remoteUrl = info.RemoteUrl ??= GetParts(components, UriFormat.SafeUnescaped); - if (IsUncOrDosPath) + if (IsFile) { return StringComparer.OrdinalIgnoreCase.GetHashCode(remoteUrl); } diff --git a/src/libraries/System.Private.Uri/tests/FunctionalTests/UriMethodsTests.cs b/src/libraries/System.Private.Uri/tests/FunctionalTests/UriMethodsTests.cs index b07938a84ebb73..5b5b7fbbaf03ef 100644 --- a/src/libraries/System.Private.Uri/tests/FunctionalTests/UriMethodsTests.cs +++ b/src/libraries/System.Private.Uri/tests/FunctionalTests/UriMethodsTests.cs @@ -347,6 +347,9 @@ public static IEnumerable Equals_TestData() yield return new object[] { new Uri("file://C:/path1/path2/file"), new Uri("http://domain.com"), false }; yield return new object[] { new Uri("file://C:/path1/path2/file"), new Uri(@"\\server\path1\path2\file"), false }; + // UNC paths that normalize to the same value as a regular file: URI + yield return new object[] { new Uri("\\\\\u202a"), new Uri("file:///"), true }; + // UNC share paths yield return new object[] { new Uri(@"\\server\sharepath\path\file"), new Uri(@"\\server\sharepath\path\file"), true }; yield return new object[] { new Uri(@"\\server\sharepath\path\file"), new Uri(@"\\server1\sharepath\path\file"), false };