Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support environment variables with empty value #103551

Merged
merged 5 commits into from
Jun 18, 2024
Merged

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Jun 17, 2024

Environment.SetEnvironment API did not make distinction between null and empty string value. It treated both as request to delete the environment variable. It made it impossible to create an environment variable with empty string value. This change updates Environment.SetEnvironment to treat empty string value as empty string value (null value is still treated as request to delete the environment variable).

Also, this change updates ProcessStartInfo.Environment to treat null vs. empty string the same way as Environment.SetEnvironment for consistency.
   
Fixes #50554
Fixes #34446

@akoeplinger
Copy link
Member

Also fixes #34446 I assume?

@jkotas
Copy link
Member Author

jkotas commented Jun 17, 2024

Also fixes #34446 I assume?

It does now - worth fixing for consistency.

@jkotas jkotas added the breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. label Jun 17, 2024
@dotnet-policy-service dotnet-policy-service bot added the needs-breaking-change-doc-created Breaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet label Jun 17, 2024
@jkotas jkotas marked this pull request as ready for review June 18, 2024 02:44
@jkotas jkotas requested a review from stephentoub June 18, 2024 02:44
@jkotas jkotas changed the title Support environment variables with no value Support environment variables with empty value Jun 18, 2024
@jkotas
Copy link
Member Author

jkotas commented Jun 18, 2024

Breaking change issue created: dotnet/docs#41471

@jkotas
Copy link
Member Author

jkotas commented Jun 18, 2024

/ba-g Known issue #103642 that has been fixed and closed already

@jkotas jkotas merged commit 2656730 into dotnet:main Jun 18, 2024
143 of 146 checks passed
@jkotas jkotas deleted the env-vars branch June 18, 2024 20:38
@github-actions github-actions bot locked and limited conversation to collaborators Jul 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Runtime breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. needs-breaking-change-doc-created Breaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet
Projects
None yet
3 participants