Skip to content

[NativeAOT] OperatingSystem.IsAndroid returns false #116738

Closed as not planned
Closed as not planned
@emmauss

Description

@emmauss

Android framework version

net10.0-android (Preview)

Affected platform version

.Net 10

Description

OperatingSystem apis which query android versions will return false when compile with NativeAOT. This includes OperatingSystem.IsAndroid and OperatingSystem.IsAndroidVersionAtLeast methods. Internally, native aot binaries are built target linux-bionic so they are treated like linux binaries and not android.

Steps to Reproduce

  1. Build the native aot sample
  2. Call OperatingSystem.IsAndroid
  3. Method returns false.

Did you find any workaround?

I'm able to check if running on android with RuntimeInformation.RuntimeIdentifier.StartsWith("linux-bionic-"), and to query android version, I use Android's Build apis. But Android's Build api isn't available in plain .net projects.

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-NativeAOT-coreclrneeds-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions