Skip to content
This repository has been archived by the owner on Nov 28, 2020. It is now read-only.

Mark Environment.OSVersion as deprecated #58

Closed
terrajobst opened this issue Oct 27, 2017 · 0 comments
Closed

Mark Environment.OSVersion as deprecated #58

terrajobst opened this issue Oct 27, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@terrajobst
Copy link
Member

Environment.OSVersion has issues, for starters it doesn't return a sensible value for macOS:

// Output:
//
//      macOS 10.12.6 (16G29)    --> Hello from Unix (Unix 16.7.0.0)
//      Ubuntu 16.04.3 LTS       --> Hello from Unix (Unix 4.4.0.43)
//      Windows 1709 (16299.19)  --> Hello from Win32NT (Microsoft Windows NT 6.2.9200.0)

Console.WriteLine($"Hello from {Environment.OSVersion.Platform} ({Environment.OSVersion})");

But as per @weshaggard there are other issues such as:

  1. People checking for exact enum values for PlatformId. That break things for Unix vs Linux vs OSX which value should I check for? I think our existing IsOSPlatform allows for better checking
  2. Also the enum value for the platform checks is nearly impossible to update in all our platforms as we add new ones. This is why OSPlatform can be default to a string until we can make the constant available in all our platforms.
  3. We cannot actually make the enum value different without breaking compat so things like OSX will never be returned as a platform as an example.
  4. Too much code does exact version checks instead of IsAtLeast this version type of check. We have yet to solve this.
  5. OS’s like windows start to lie about the OSVersion because of people doing exact version checks so then folks really don’t have a value to query. We can help with this with better version check APIs.
  6. We want to help folks find other ways to solve the scenarios they would use version for (i.e. feature light-up) to help eliminate some of the need to do version checks at all.
@terrajobst terrajobst self-assigned this Oct 27, 2017
@OliaG OliaG added the P1 label Dec 1, 2017
@OliaG OliaG added this to the 0.2.0-alpha milestone Dec 1, 2017
@OliaG OliaG assigned pjanotti and unassigned terrajobst Jan 4, 2018
pjanotti pushed a commit to pjanotti/platform-compat that referenced this issue Jan 5, 2018
pjanotti pushed a commit that referenced this issue Jan 5, 2018
* Mark Environment.OSVersion as deprecated

Fixes #58

* Small rewording of DE0009 doc

* Taking mairaw review feedback
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants