Skip to content

'ProcessStartInfo.EnvironmentVariables ["FOO"] = null' launches with empty environment variable #34446

Description

@rolfbjarne

Repro:

class Program
{
    static void Main(string[] args)
    {
        var process = new System.Diagnostics.Process();
        process.StartInfo.FileName = "env";
        process.StartInfo.UseShellExecute = false;
        process.StartInfo.EnvironmentVariables ["FOO"] = null;
        process.Start();
        process.WaitForExit ();
    }
}

Execute:

$ dotnet run | grep FOO
FOO=

Try with mono:

csc *.cs /nologo && mono *.exe | grep FOO
[no output]

Allowing setting an environment variable to null to remove it would match the behavior of the Environment class, where you're supposed to Environment.SetEnvironmentVariable ("FOO", null); to delete that variable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions