-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Open
Labels
area-System.RuntimeuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Description
As pointed by @stephentoub in #124271 (comment):
var d = Environment.GetEnvironmentVariables();
d.Clear();
d.Add("s", 123);
d.Add("S", 456);
foreach (var v in d)
{
Console.WriteLine(v);
}prints
[S, 456]
[s, 123]
rather than
[S, 456]
I personally don't have a strong opinion on this, the API just returns a snapshot. However, if we decide to change it, we could eliminate some extra copying when creating env var dictionary for process:
runtime/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.cs
Lines 99 to 101 in e771b59
| _environmentVariables = new DictionaryWrapper(new Dictionary<string, string?>( | |
| envVars.Count, | |
| OperatingSystem.IsWindows() ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal)); |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.RuntimeuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner