From a7ae95143503437e23e897b66ddc955c6ed17a0b Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Mon, 11 Nov 2024 14:30:10 +0100 Subject: [PATCH 1/2] Make VBCSCompiler pipe name insensitive to casing of the path --- .../Server/VBCSCompilerTests/BuildClientTests.cs | 8 ++++++++ src/Compilers/Shared/BuildServerConnection.cs | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs b/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs index bca3ced3dcea0..53c327be7866a 100644 --- a/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs +++ b/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs @@ -344,6 +344,14 @@ public void GetPipeNameForPathOptLength() // We only have ~50 total bytes to work with on mac, so the base path must be small Assert.Equal(43, name.Length); } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/75714")] + public void GetPipeNameForPath_Casing() + { + var path1 = string.Format(@"q:{0}the{0}path", Path.DirectorySeparatorChar); + var path2 = string.Format(@"Q:{0}The{0}Path", Path.DirectorySeparatorChar); + Assert.Equal(BuildServerConnection.GetPipeName(path1), BuildServerConnection.GetPipeName(path2)); + } } } } diff --git a/src/Compilers/Shared/BuildServerConnection.cs b/src/Compilers/Shared/BuildServerConnection.cs index 2803cd46929ce..7901c504bd6bc 100644 --- a/src/Compilers/Shared/BuildServerConnection.cs +++ b/src/Compilers/Shared/BuildServerConnection.cs @@ -564,6 +564,9 @@ internal static string GetPipeName( // of this method. clientDirectory = clientDirectory.TrimEnd(Path.DirectorySeparatorChar); + // Similarly, we don't want multiple servers if the path differs in casing. + clientDirectory = clientDirectory.ToLowerInvariant(); + var pipeNameInput = $"{userName}.{isAdmin}.{clientDirectory}"; using (var sha = SHA256.Create()) { From 8280879ab3ffba73914f20570adb3403480a6ec4 Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Tue, 12 Nov 2024 10:29:45 +0100 Subject: [PATCH 2/2] Improve comment wording Co-authored-by: Jared Parsons --- src/Compilers/Shared/BuildServerConnection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compilers/Shared/BuildServerConnection.cs b/src/Compilers/Shared/BuildServerConnection.cs index 7901c504bd6bc..c8596ba8b7dc1 100644 --- a/src/Compilers/Shared/BuildServerConnection.cs +++ b/src/Compilers/Shared/BuildServerConnection.cs @@ -564,7 +564,7 @@ internal static string GetPipeName( // of this method. clientDirectory = clientDirectory.TrimEnd(Path.DirectorySeparatorChar); - // Similarly, we don't want multiple servers if the path differs in casing. + // Similarly, we don't want multiple servers if the provided launch path differs in casing. clientDirectory = clientDirectory.ToLowerInvariant(); var pipeNameInput = $"{userName}.{isAdmin}.{clientDirectory}";