Should Environment.GetEnvironmentVariables return case-insensitive collection on Windows?
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
As pointed by @stephentoub in https://github.com/dotnet/runtime/pull/124271#discussion_r2800533246:
```csharp
var d = Environment.GetEnvironmentVariables();
d.Clear();
d.Add("s", 123);
d.Add("S", 456);
foreach (var v in d)
{
Console.WriteLine(v);
}
```
prints
```log
[S, 456]
[s, 123]
```
rather than
```log
[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:
https://github.com/dotnet/runtime/blob/e771b591f55da956c59c2bca8250adde76c608aa/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.cs#L99-L101
cc @GrabYourPitchforks
Contributor guide
Assessment
This issue has not been assessed yet.