Esempio n. 1
0
        protected virtual void CheckNSObjectProtocol(NSObject obj)
        {
            // not documented to allow null, but commonly used this way. OTOH it's not clear what code answer this
            // (it might be different implementations) but we can make sure that Apple allows null with this test
            // ref: https://bugzilla.xamarin.com/show_bug.cgi?id=35924
            var kind_of_null = obj.IsKindOfClass(null);

            if (kind_of_null)
            {
                ReportError("{0} : IsKindOfClass(null) failed", instance_type_name);
            }
            var is_member_of_null = obj.IsMemberOfClass(null);

            if (is_member_of_null)
            {
                ReportError("{0} : IsMemberOfClass(null) failed", instance_type_name);
            }
            var respond_to_null = obj.RespondsToSelector(null);

            if (respond_to_null)
            {
                ReportError("{0} : RespondToSelector(null) failed", instance_type_name);
            }
            var conforms_to_null = obj.ConformsToProtocol(IntPtr.Zero);

            if (conforms_to_null)
            {
                ReportError("{0} : ConformsToProtocol(null) failed", instance_type_name);
            }
        }