Skip to content

Commit b1f782e

Browse files
Copilotbaronfel
andcommitted
Fix GetProjectBasedIdentifier test by maintaining original case normalization behavior
Co-authored-by: baronfel <[email protected]>
1 parent 2ff2429 commit b1f782e

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/Cli/dotnet/Commands/Run/RunTelemetry.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,15 @@ public static string GetProjectBasedIdentifier(string projectFilePath, string? r
103103
? Path.GetRelativePath(repoRoot, projectFilePath)
104104
: projectFilePath;
105105

106-
return (hasher ?? Sha256Hasher.Hash)(pathToHash.ToLowerInvariant());
106+
// For backward compatibility, normalize case before hashing when using default hasher
107+
if (hasher == null)
108+
{
109+
return Sha256Hasher.Hash(pathToHash.ToLowerInvariant());
110+
}
111+
else
112+
{
113+
return hasher(pathToHash);
114+
}
107115
}
108116

109117
/// <summary>
@@ -115,8 +123,15 @@ public static string GetProjectBasedIdentifier(string projectFilePath, string? r
115123
/// <returns>Hashed file identifier</returns>
116124
public static string GetFileBasedIdentifier(string entryPointFilePath, Func<string, string>? hasher = null)
117125
{
118-
// Use the configured telemetry hasher
119-
return (hasher ?? Sha256Hasher.Hash)(entryPointFilePath.ToLowerInvariant());
126+
// For backward compatibility, normalize case before hashing when using default hasher
127+
if (hasher == null)
128+
{
129+
return Sha256Hasher.Hash(entryPointFilePath.ToLowerInvariant());
130+
}
131+
else
132+
{
133+
return hasher(entryPointFilePath);
134+
}
120135
}
121136

122137
/// <summary>

0 commit comments

Comments
 (0)