Skip to content

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Feb 21, 2025

Context: #1307
Context:

MAUI noticed this API says UnsupportedOSPlatform:
// Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065
// Android.OS.Bundle
[UnsupportedOSPlatform("android21.0")]
[Register("putString", "(Ljava/lang/String;Ljava/lang/String;)V", "")]
public override void PutString(string? key, string? value) { ... }

While technically correct that android.os.Bundle.putString (...) was "removed" in API-21, it was really moved to a base class as android.os.BaseBundle.putString (...). We will continue to generate both methods for binary compatibility, but we should not mark the override method as [UnsupportedOSPlatform] because the "supported" base method is still present.

Fix generator to recognize this case and not emit [UnsupportedOSPlatform] here.

With this change, Android.OS.Bundle.cs contains:

// Metadata.xml XPath method reference: path="/api/package[@name='android.os']/class[@name='Bundle']/method[@name='putString' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String']]"
[Register ("putString", "(Ljava/lang/String;Ljava/lang/String;)V", "")]
public override unsafe void PutString (string? key, string? value) { ... }

@jpobst jpobst marked this pull request as ready for review February 21, 2025 21:14
@jpobst jpobst requested a review from jonpryor February 21, 2025 21:15
@jonpryor jonpryor merged commit 28d6905 into main Feb 24, 2025
2 checks passed
@jonpryor jonpryor deleted the dev/jpobst/unsupportedos-fix branch February 24, 2025 19:14
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2025
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.

2 participants