xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

[Bug] Missing a crucial warning in the NSMenu.Items documentation. #15859

Closed ShikiSuen closed 4 months ago

ShikiSuen commented 4 months ago

Description

[Bug] Missing a crucial warning in the NSMenu.Items documentation.

NSMenu.items is read-only for macOS 10.13 and earlier, according to the objc header:

/* Returns an array containing the receiver's menu items. 
   This property is settable in macOS 10.14 and later. */

Assigning a value (any Array) to this property will cause a runtime issue in macOS 10.13 and earlier:

[NSMenu setItemArray:]: unrecognized selector sent to instance。

... and its view hierachy fails to load.

It might takes years to wait Apple for fixing their bug-plagued Xcode documentation (FB13601910). However, it seems that Microsoft documentation can add this crucial information separately.

https://learn.microsoft.com/en-us/dotnet/api/appkit.nsmenu.items?view=xamarin-mac-sdk-14

Steps to Reproduce

N/A

Expected Behavior

The above mentioned Microsoft documentation needs to mention this crucial fact.

Actual Behavior

The crucial fact mentioned above is missing in both Microsoft documentation and Apple Xcode documentation of NSMenu.items.

Basic Information

jfversluis commented 4 months ago

As you can see on the linked page, this API is already marked as only available for macOS 10.14+ so you cannot even use this API in lower target versions. Additionally, this is not relevant to Xamarin.Forms, but more Xamarin.iOS and even more so: the docs pages if you're looking to add a warning to that.

Thanks for sharing this!