Fix application crashes if there are two environment variables with same name, differing only in case (#67)

This commit is contained in:
Ron Myers
2020-07-28 08:20:02 -03:00
committed by GitHub
parent b491818779
commit 9a20101f30
4 changed files with 28 additions and 5 deletions

View File

@@ -206,7 +206,7 @@ namespace CliFx.Analyzers
// Duplicate environment variable name
var duplicateEnvironmentVariableNameOptions = options
.Where(p => !string.IsNullOrWhiteSpace(p.EnvironmentVariableName))
.GroupBy(p => p.EnvironmentVariableName, StringComparer.OrdinalIgnoreCase)
.GroupBy(p => p.EnvironmentVariableName, StringComparer.Ordinal)
.Where(g => g.Count() > 1)
.SelectMany(g => g.AsEnumerable())
.ToArray();