Incorrect SupportedOSPlatform attributes on various properties · Issue #19209 · dotnet/macios (original) (raw)
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
There's probably even more properties for which Apple changed their min API level with the last SDK...
Environment
.NET 8 RC2