Skip to content

Incorrect SupportedOSPlatform attributes on various properties #19209

@tipa

Description

@tipa

Similar bug report as here: #19066

Steps to Reproduce

Use NSMutableParagraphStyle.TextLists in a project with MinimumOSVersion < 16.0

Expected Behavior

No warning

Actual Behavior

/Users/tipa/GitHub/diarium/Diarium/Classes/Helper_macios.cs(99,25): warning CA1416: This call site is reachable on: 'iOS' 15.0 and later, 'maccatalyst' 15.0 and later. 'NSParagraphStyle.TextLists' is only supported on: 'ios' 16.0 and later, 'maccatalyst' 16.0 and later, 'tvos' 16.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Comments

Documented to be available since iOS 7:
https://developer.apple.com/documentation/uikit/nsparagraphstyle/1534193-textlists?language=objc

https://github.com/xamarin/xamarin-macios/blob/343699204a3ff1f591e861e046baa672fc7e6626/src/xkit.cs#L1797-L1799
I haven't tested functionality yet, but at least setting & getting the property does not crash on iOS 15:

var xx = new NSMutableParagraphStyle();
xx.TextLists = new[] { new NSTextList(NSTextListMarkerFormats.Circle) };
var yy = xx.TextLists[0];

Documented to be available since iOS 9:
https://developer.apple.com/documentation/uikit/nsparagraphstyle/3667463-linebreakstrategy?language=objc

https://github.com/xamarin/xamarin-macios/blob/343699204a3ff1f591e861e046baa672fc7e6626/src/xkit.cs#L1811-L1814

There's probably even more properties for which Apple changed their min API level with the last SDK...

Environment

.NET 8 RC2

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThe issue or pull request is an enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions