Skip to content

Using GetEnvironmentVariables wipes all envvars #58156

@rolfbjarne

Description

@rolfbjarne

From @mattleibow on Thu, 26 Aug 2021 02:52:28 GMT

Steps to Reproduce

Add this to the static Main

Console.WriteLine($"BEFORE:");
Console.WriteLine($"  NUNIT_AUTOEXIT = {Environment.GetEnvironmentVariable("NUNIT_AUTOEXIT")}");
Console.WriteLine($"  NUNIT_AUTOEXIT = {Environment.GetEnvironmentVariable("NUNIT_AUTOEXIT")}");
Environment.GetEnvironmentVariables();
Console.WriteLine($"AFTER:");
Console.WriteLine($"  NUNIT_AUTOEXIT = {Environment.GetEnvironmentVariable("NUNIT_AUTOEXIT")}");
Console.WriteLine($"  NUNIT_AUTOEXIT = {Environment.GetEnvironmentVariable("NUNIT_AUTOEXIT")}");
[15645:495793] BEFORE:
[15645:495793]   NUNIT_AUTOEXIT = true
[15645:495793]   NUNIT_AUTOEXIT = true
[15645:495793] AFTER:
[15645:495793]   NUNIT_AUTOEXIT =
[15645:495793]   NUNIT_AUTOEXIT =

I did notice that setting the envvars in the app set them permanently. So this has to come in from the outside - say mlaunch.

Expected Behavior

Actual Behavior

Environment

dotnet 6.0.100-rc.1.21418.8
ios 15.0.100-rc.1.521

Build Logs

Example Project (If Possible)

% /Users/matthew/.nuget/packages/microsoft.dotnet.xharness.cli/1.0.0-prerelease.21425.2/tools/net6.0/any/../../../runtimes/any/native/mlaunch/bin/mlaunch --sdkroot /Applications/Xcode.app -setenv=NUNIT_AUTOEXIT=true --device=:v2:udid=D3340DC9-6B35-4EB9-85C6-C42DAE846897 --launchsimbundleid=com.companyname.TestingSubvioews -v -v -v -v -v

TestingSubvioews.zip

Copied from original issue dotnet/macios#12555

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions