You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 9, 2026. It is now read-only.
Repository navigation
Commit 1cfb4f4
Browse filesBrowse the repository at this point in the historyBrowse files
[generator] Add support for emitting [UnsupportedOSPlatform] (#1307)
Fixes: #1309
Context: dotnet/android@944d306
Sometimes, Android *removes* APIs. For example, API-23 *removed* the
`android.Manifest.permission.CLEAR_APP_USER_DATA` field.
We still list this field, though:
[`Android.Manifest.Permission.ClearAppUserData` field][0].
> [Android.Runtime.Register("CLEAR_APP_USER_DATA")]
> public const string ClearAppUserData;
In dotnet/android@944d3061 we updated `api-merge` to emit
`//*/@#removed-since`. Consider this snippet from
[`android/src/Mono.Android/Profiles/api-35.xml`][1]:
<field
deprecated="not deprecated" final="true"
name="CLEAR_APP_USER_DATA" jni-signature="Ljava/lang/String;"
static="true" transient="false" type="java.lang.String" type-generic-aware="java.lang.String"
value=""android.permission.CLEAR_APP_USER_DATA""
visibility="public" volatile="false"
removed-since="23"
/>
Modify `generator` to consume this information and emit
`[UnsupportedOSPlatformAttribute ("androidXX.0")]` as needed for API
that has been removed from `Mono.Android`. This would update
`Android.Manifest.Permission.ClearAppUserData` to be:
[Android.Runtime.Register("CLEAR_APP_USER_DATA")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute ("android23.0")]
public const string ClearAppUserData;
[0]: https://learn.microsoft.com/en-us/dotnet/api/android.manifest.permission.clearappuserdata?view=net-android-34.0
[1]: https://github.com/dotnet/android/blob/d012fb811b4bcebe260400f5fc7a0287108336d7/src/Mono.Android/Profiles/api-35.xml
0 commit comments