Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 678cf13

Browse files
committed
Using OrdinalIgnoreCase to work around locale specific issues when trying to determine if a command line input is an argument.
1 parent 2ee6aeb commit 678cf13

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/dotnet/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ internal static int ProcessArgs(string[] args, ITelemetry telemetryClient = null
111111
HelpCommand.PrintHelp();
112112
return 0;
113113
}
114-
else if (args[lastArg].StartsWith("-"))
114+
else if (args[lastArg].StartsWith("-", StringComparison.OrdinalIgnoreCase))
115115
{
116116
Reporter.Error.WriteLine($"Unknown option: {args[lastArg]}");
117117
success = false;
@@ -265,7 +265,8 @@ private static bool IsArg(string candidate, string longName)
265265

266266
private static bool IsArg(string candidate, string shortName, string longName)
267267
{
268-
return (shortName != null && candidate.Equals("-" + shortName)) || (longName != null && candidate.Equals("--" + longName));
268+
return (shortName != null && candidate.Equals("-" + shortName, StringComparison.OrdinalIgnoreCase)) ||
269+
(longName != null && candidate.Equals("--" + longName, StringComparison.OrdinalIgnoreCase));
269270
}
270271

271272
private static string GetDisplayRid(DotnetVersionFile versionFile)

0 commit comments

Comments
 (0)