diff --git a/tests/introspection/ApiSignatureTest.cs b/tests/introspection/ApiSignatureTest.cs index dab0ee507cc6..1fadf6807949 100644 --- a/tests/introspection/ApiSignatureTest.cs +++ b/tests/introspection/ApiSignatureTest.cs @@ -645,6 +645,12 @@ protected virtual bool Check (char encodedType, Type type) { switch (encodedType) { case '@': + // We use BindAsAttribute to wrap NSNumber/NSValue into more accurate Nullable types + // So we check if T of nullable is supported by bindAs + var nullableType = Nullable.GetUnderlyingType (type); + if (nullableType != null) + return BindAsSupportedTypes.Contains (nullableType.Name); + return (type.IsInterface || // protocol type.IsArray || // NSArray (type.Name == "NSArray") || // NSArray @@ -978,5 +984,14 @@ protected virtual bool IgnoreAsync (MethodInfo m) } return false; } + + // This must be kept in sync with generator.cs NSValueCreateMap and NSValueReturnMap + protected HashSet BindAsSupportedTypes = new HashSet { + "CGAffineTransform", "Range", "CGVector", "SCNMatrix4", "CLLocationCoordinate2D", + "SCNVector3", "Vector", "CGPoint", "CGRect", "CGSize", "UIEdgeInsets", + "UIOffset", "MKCoordinateSpan", "CMTimeRange", "CMTime", "CMTimeMapping", + "CATransform3D", "Boolean", "Byte", "Double", "Float", "Int16", "Int32", + "Int64", "SByte", "UInt16", "UInt32", "UInt64", "nfloat", "nint", "nuint", + }; } }