Skip to content

What is the rationale behind quietly ignoring Environment.SetEnvironmentVariable calls with targets User or Machine on Unix-like platforms? #27566

@mklement0

Description

@mklement0

Persistently updating environment variables is (at least currently) only supported on Windows, which means passing the User and Machine enumeration values to Environment.SetEnvironmentVariable are unsupported on macOS and Linux.

Surprisingly, however, doing the latter doesn't cause an exception, but is quietly ignored (an effective no-op).

Even though this behavior is documented, I wonder:

  • what the rationale for this behavior is, given that as an API user you generally want to be notified of attempts to use functionality that is unsupported on a given platform.

  • whether the behavior can be changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.RuntimequestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions