diff --git a/src/foundation.cs b/src/foundation.cs index 4518599ce784..b70d2b66f2ef 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -13775,7 +13775,7 @@ partial interface NSHost { NSHost _FromAddress (string address); [Export ("isEqualToHost:")] - bool Equals (NSHost host); + bool Equals ([NullAllowed] NSHost host); [Export ("name")] string Name { get; } diff --git a/tests/monotouch-test/Foundation/NSHostTest.cs b/tests/monotouch-test/Foundation/NSHostTest.cs new file mode 100644 index 000000000000..ec9368072fa6 --- /dev/null +++ b/tests/monotouch-test/Foundation/NSHostTest.cs @@ -0,0 +1,22 @@ +#if __MACOS__ +using System; +using System.Collections; +using System.Collections.Generic; + +using NUnit.Framework; + +using Foundation; + +#nullable enable + +namespace MonoTouchFixtures.Foundation { + public class NSHostTest { + + public void EqualsNullAllowed () + { + using var host = NSHost.FromAddress ("http://microsoft.com"); + Assert.False (host.Equals (null)); + } + } +} +#endif diff --git a/tests/xtro-sharpie/macOS-Foundation.ignore b/tests/xtro-sharpie/macOS-Foundation.ignore index ab74c230b79f..f3e410f800e9 100644 --- a/tests/xtro-sharpie/macOS-Foundation.ignore +++ b/tests/xtro-sharpie/macOS-Foundation.ignore @@ -834,3 +834,6 @@ !missing-null-allowed! 'System.Void Foundation.NSUserNotification::set_Subtitle(System.String)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void Foundation.NSUserNotification::set_Title(System.String)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void Foundation.NSUserNotification::set_UserInfo(Foundation.NSDictionary)' is missing an [NullAllowed] on parameter #0 + +# added because the method does the right thing yet it was not marked by apple, there is a test for it +!extra-null-allowed! 'System.Boolean Foundation.NSHost::Equals(Foundation.NSHost)' has a extraneous [NullAllowed] on parameter #0