Bug 8884 - Environment.SetEnvironmentVariable not working correctly on non windows OS'es
Summary: Environment.SetEnvironmentVariable not working correctly on non windows OS'es
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-12-11 13:56 UTC by Karol Gwaj
Modified: 2012-12-11 13:56 UTC (History)
1 user (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Karol Gwaj 2012-12-11 13:56:42 UTC
Environment.SetEnvironmentVariable not setting environment variables if EnvironmentVariableTarget is Machine or User (working fine for Process), after checking the code i found this:

case EnvironmentVariableTarget.Machine:
    if (!IsRunningOnWindows)
case EnvironmentVariableTarget.Process:
    if (!IsRunningOnWindows)

so it will actually never work on non windows OS. I think mono as cross platform framework should work this same on every operating system.

Also maybe instead of returning silently for non windows OS, it should throw NotImplementedException (or NotSupportedException) depending on the future plans for this functionality. To be honest it will save me a lot of time if i will know from first try that this method is not fully supported on unix (I spend good 1h trying some workarounds before deciding to look into the implementation)

Note You need to log in before you can comment on or make changes to this bug.