Skip to content

Conversation

jonathanpeppers
Copy link
Member

Context: #1313
Fixes: dotnet/android#10509

In .NET 10 RC 1, View.Foreground is defined in C# as:

[SupportedOSPlatform("android23.0")]
public virtual Drawable? Foreground { get; set; }

But FrameLayout.Foreground is defined as:

[UnsupportedOSPlatform("android23.0")]
public override Drawable? Foreground { get; set; }

I think this is the exact same bug that was addressed in #1313 for methods, but we still have the issue for properties. I was able to duplicate the test and make a getThing() and setThing() methods in Java to see the issue.

I updated the FixupMethodOverrides() to iterate over properties and do the same fixup for property getters and setters.

Context: #1313
Fixes: dotnet/android#10509

In .NET 10 RC 1, `View.Foreground` is defined in C# as:

    [SupportedOSPlatform("android23.0")]
    public virtual Drawable? Foreground { get; set; }

But `FrameLayout.Foreground` is defined as:

    [UnsupportedOSPlatform("android23.0")]
    public override Drawable? Foreground { get; set; }

I think this is the exact same bug that was addressed in #1313 for
methods, but we still have the issue for properties. I was able to
duplicate the test and make a `getThing()` and `setThing()` methods in
Java to see the issue.

I updated the `FixupMethodOverrides()` to iterate over properties
and do the same fixup for property getters and setters.
jonathanpeppers added a commit to dotnet/android that referenced this pull request Sep 22, 2025
@jonathanpeppers
Copy link
Member Author

These APIs look OK now:

image

I still see this one, though:

image

jonathanpeppers added a commit that referenced this pull request Sep 22, 2025
Context: #1313
Context: dotnet/android#10509

Reverts:

* 28d6905
* 1cfb4f4

To reduce the chance of breakage in .NET 10, going to revert this feature on `release/10.0.1xx`.

The changes will be left in `main` along with the fix:

* #1366
@jonathanpeppers
Copy link
Member Author

Ok, the latest changes look OK for this API now:

image

I'm going to add a test in dotnet/android that has code like:

new FrameLayout(this).Foreground = null;
new ListView(this).Adapter = null;

// these do not cause errors in a Java Android project
// using those stat below API 29 works without problem
// likely related: https://stackoverflow.com/questions/64376737 
var a = MediaStore.Video.IVideoColumns.DateTaken;
var b = MediaStore.Images.IImageColumns.DateTaken;

@jonathanpeppers jonathanpeppers marked this pull request as ready for review September 23, 2025 13:40
@jonathanpeppers jonathanpeppers merged commit ef82a07 into main Sep 23, 2025
2 checks passed
@jonathanpeppers jonathanpeppers deleted the dev/peppers/property-overrides branch September 23, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect CA1416 warnings

2 participants