Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

[System.Runtime.InteropServices] Introduce broader platform definitions. - #27378

Closed
migueldeicaza wants to merge 1 commit into
dotnet:masterfrom
migueldeicaza:extended-platforms
Closed

migueldeicaza wants to merge 1 commit into
dotnet:masterfrom
migueldeicaza:extended-platforms

Conversation

@migueldeicaza

Copy link
Copy Markdown

Unity, Xamarin and Mono users suffers from a historic problem with
platform detection. This patch introduces definitions for all the
existing platforms that .NET supports beyond .NET Core via Unity and
Xamarin.

To cope with the historical setting that OSX has been used in existing
code to probe for an Apple OS (iOS, tvOS, watchOS), we introduce new
values for all four apple platforms (macOS, iOS, tvOS, watchOS) and
also return true when probed for the legacy OSX setting.

The same principle is applied to Linux, we will continue to return
true, but the more specific versions of Tizen and Android are
supported.

The list has been expanded to all the platforms currently supported by
Mono and Unity.

Unity, Xamarin and Mono users suffers from a historic problem with
platform detection.  This patch introduces definitions for all the
existing platforms that .NET supports beyond .NET Core via Unity and
Xamarin.

To cope with the historical setting that OSX has been used in existing
code to probe for an Apple OS (iOS, tvOS, watchOS), we introduce new
values for all four apple platforms (macOS, iOS, tvOS, watchOS) and
also return true when probed for the legacy OSX setting.

The same principle is applied to Linux, we will continue to return
true, but the more specific versions of Tizen and Android are
supported.

The list has been expanded to all the platforms currently supported by
Mono and Unity.
@stephentoub

Copy link
Copy Markdown
Member

Hey @migueldeicaza! Thanks for the PR. For new public surface area, we follow the process outlined in https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/api-review-process.md, which essentially includes opening an issue proposing the new APIs with rationale and then reviewing that in a weekly API review meeting; once APIs are approved, PRs can be opened to fix that issue by implementing/exposing the members. Mind opening such an issue and closing this in the interim? You can mark the issue as api-ready-for-review so that it appears in the searches done when going through issues in the review meeting.

{
private readonly string _osPlatform;

public static OSPlatform Android { get; } = new OSPlatform("ANDROID");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return OSPlatform.Tizen.Equals (name) ||
OSPlatform.Android.Equals (name);
}
return false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: indentation here is all wonky

@stephentoub

Copy link
Copy Markdown
Member

cc: @weshaggard, @terrajobst

@migueldeicaza

Copy link
Copy Markdown
Author

Pull request to discuss the API change proposal:

https://github.com/dotnet/corefx/issues/27417

Closing this in the meantime.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants