protected override bool Skip(Type type)
        {
            switch (type.FullName)
            {
            // OS X 10.8 +
            case "MonoMac.AppKit.NSSharingService":
            case "AppKit.NSSharingService":
            case "MonoMac.Foundation.NSUserNotification":
            case "Foundation.NSUserNotification":
                return(!Mac.CheckSystemVersion(10, 8));
            }

            switch (type.Namespace)
            {
            // OSX 10.8+
            case "MonoMac.Accounts":
            case "Accounts":
            case "MonoMac.GameKit":
            case "GameKit":
            case "MonoMac.Social":
            case "Social":
                return(!Mac.CheckSystemVersion(10, 8));

            case "SceneKit":
            case "MonoMac.SceneKit":
                return(!Mac.CheckSystemVersion(10, 8) || IntPtr.Size != 8);

            default:
                return(false);
            }
        }
        protected override bool Skip(string nativeName)
        {
            switch (nativeName)
            {
            case "CIEdgePreserveUpsampleFilter":     // Appears in 10.13 but not documented
            case "CIMaskedVariableBlur":             // Appears removed in 10.11 but not documented
                if (Mac.CheckSystemVersion(10, 11))
                {
                    return(true);
                }
                break;

            case "CICMYKHalftone":             // Renamed as CICmykHalftone
                return(true);

            case "CIAreaMinMax":
            case "CICameraCalibrationLensCorrection":
            case "CIDither":
            case "CIGuidedFilter":
            case "CIMeshGenerator":
            case "CIMix":
            case "CISampleNearest":
                if (IntPtr.Size == 4)
                {
                    return(true);
                }
                break;
            }
            return(base.Skip(nativeName));
        }
Esempio n. 3
0
        public override void SupportsSecureCoding()
        {
            if (!Mac.CheckSystemVersion(10, 8))
            {
                return;
            }

            base.SupportsSecureCoding();
        }
Esempio n. 4
0
        protected override void Dispose(NSObject obj, Type type)
        {
            switch (type.FullName)
            {
            // FIXME: those crash the application when Dispose is called
            case "MonoMac.JavaScriptCore.JSManagedValue":
            case "JavaScriptCore.JSManagedValue":
                // JSManagedValue crashes in Yosemite (b7), but not Mavericks.
                if (!Mac.CheckSystemVersion(10, 10))
                {
                    goto default;
                }
                goto case "MonoMac.ImageKit.IKScannerDeviceView"; // fallthrough

            case "MonoMac.ImageKit.IKScannerDeviceView":          // 19835
            case "ImageKit.IKScannerDeviceView":
            case "MonoMac.AppKit.NSFontPanel":                    // *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x11491cc00 of class NSButton was deallocated while key value observers were still registered with it.
            case "AppKit.NSFontPanel":
            case "MonoMac.AVFoundation.AVAudioRecorder":          // same on iOS
            case "AVFoundation.AVAudioRecorder":
            case "MonoMac.Foundation.NSUrlConnection":
            case "Foundation.NSUrlConnection":
            // 10.8:
            case "MonoMac.Accounts.ACAccount":                                                                                  // maybe the default .ctor is not allowed ?
            case "Accounts.ACAccount":
            case "MonoMac.Accounts.ACAccountCredential":
            case "Accounts.ACAccountCredential":
            case "MonoMac.Accounts.ACAccountStore":
            case "Accounts.ACAccountStore":
            case "MonoMac.Accounts.ACAccountType":
            case "Accounts.ACAccountType":
            case "MonoMac.CoreData.NSPersistentStoreCoordinator":
            case "CoreData.NSPersistentStoreCoordinator":
            case "AppKit.NSColorPanel":
            case "MonoMac.AppKit.NSColorPanel":
            case "Foundation.NSFileProviderService":
            case "MonoMac.Foundation.NSFileProviderService":
                do_not_dispose.Add(obj);
                break;

            // 10.11
            case "MonoMac.CoreImage.CIImageAccumulator":
            case "CoreImage.CIImageAccumulator":
            case "WebKit.WKNavigation":
                // crashes on El Capitan (b2) but not before
                if (!Mac.CheckSystemVersion(10, 11))
                {
                    goto default;
                }
                do_not_dispose.Add(obj);
                break;

            default:
                base.Dispose(obj, type);
                break;
            }
        }
Esempio n. 5
0
        protected override bool Skip(string nativeName)
        {
            switch (nativeName)
            {
            case "CIEdgePreserveUpsampleFilter":     // Appears in 10.13 but not documented
            case "CIMaskedVariableBlur":             // Appears removed in 10.11 but not documented
                if (Mac.CheckSystemVersion(10, 11))
                {
                    return(true);
                }
                break;

            case "CICMYKHalftone":             // Renamed as CICmykHalftone
                return(true);

#if !__UNIFIED__
            case "CIAreaMinMaxRed":
            case "CIAttributedTextImageGenerator":
            case "CIBarcodeGenerator":
            case "CIBicubicScaleTransform":
            case "CIBlendWithBlueMask":
            case "CIBlendWithRedMask":
            case "CIBokehBlur":
            case "CIColorCubesMixedWithMask":
            case "CIColorCurves":
            case "CIDepthBlurEffect":
            case "CIDepthToDisparity":
            case "CIDisparityToDepth":
            case "CILabDeltaE":
            case "CIMorphologyGradient":
            case "CIMorphologyMaximum":
            case "CIMorphologyMinimum":
            case "CITextImageGenerator":
                return(true);
#endif
            case "CIAreaMinMax":
            case "CICameraCalibrationLensCorrection":
            case "CIDither":
            case "CIGuidedFilter":
            case "CIMeshGenerator":
            case "CIMix":
            case "CISampleNearest":
                if (IntPtr.Size == 4)
                {
                    return(true);
                }
                break;
            }
            return(base.Skip(nativeName));
        }
        protected override int Size(Type t, bool simd = false)
        {
            switch (t.FullName)
            {
            case "GameKit.GKGameCenterViewControllerState":
            case "AppKit.NSOpenGLContextParameter":
                // NSOpenGLContextParameter and GKGameCenterViewControllerState are anonymous enums in 10.9, but an NSInteger in 10.10.
                if (IntPtr.Size == 8 && !Mac.CheckSystemVersion(10, 10))
                {
                    return(4);
                }
                break;
            }

            return(base.Size(t, simd));
        }
        protected override bool Skip(string constantName, string libraryName)
        {
            switch (constantName)
            {
            case "CBUUIDValidRangeString":
                if (Mac.CheckSystemVersion(10, 13))                  // radar 32858911
                {
                    return(true);
                }
                goto default;

            // Only there for API compat
            case "kSecUseNoAuthenticationUI":
            case "kSecUseOperationPrompt":
                return(!IsUnified);

            // MonoMac.CoreServices.CFHTTPMessage - document in 10.9 but returns null
            case "kCFHTTPAuthenticationSchemeOAuth1":
                return(true);

            // kCLErrorUserInfoAlternateRegionKey also returns null on iOS
            case "kCLErrorUserInfoAlternateRegionKey":
                return(true);

            case "NSURLSessionTransferSizeUnknown":
            case "NSURLSessionDownloadTaskResumeData":
                if (Mac.Is32BitMavericks)
                {
                    return(true);
                }
                goto default;

#if !UNIFIED
            case "QCCompositionInputRSSArticleDurationKey":
            case "QCCompositionInputRSSFeedURLKey":
            case "QCCompositionProtocolRSSVisualizer":
                if (Mac.CheckSystemVersion(10, 14))
                {
                    return(true);
                }
                goto default;
#endif
            default:
                return(base.Skip(constantName, libraryName));
            }
        }
Esempio n. 8
0
        protected override bool Skip(string nativeName)
        {
            switch (nativeName)
            {
            case "CIMaskedVariableBlur":             // Appears removed in 10.11 but not documented
                if (Mac.CheckSystemVersion(10, 11))
                {
                    return(true);
                }
                return(false);

            case "CICMYKHalftone":             // Renamed as CICmykHalftone
                return(true);

            default:
                return(base.Skip(nativeName));
            }
        }
Esempio n. 9
0
        protected override bool Skip(Type type)
        {
            switch (type.FullName)
            {
            // OS X 10.8 +
            case "MonoMac.AppKit.NSSharingService":
            case "AppKit.NSSharingService":
            case "MonoMac.Foundation.NSUserNotification":
            case "Foundation.NSUserNotification":
                return(!Mac.CheckSystemVersion(10, 8));
            }

            switch (type.Namespace)
            {
            // OSX 10.8+
            case "MonoMac.Accounts":
            case "Accounts":
            case "MonoMac.GameKit":
            case "GameKit":
            case "MonoMac.Social":
            case "Social":
                return(!Mac.CheckSystemVersion(10, 8));

            case "SceneKit":
            case "MonoMac.SceneKit":
                return(!Mac.CheckSystemVersion(10, 8) || IntPtr.Size != 8);

            case "MediaPlayer":
            case "MonoMac.MediaPlayer":
                if (!Mac.CheckSystemVersion(10, 12) || IntPtr.Size != 8)
                {
                    return(true);
                }
                break;

            case "MonoMac.QTKit":             // QTKit has been removed from macOS
            case "QTKit":
                return(true);
            }
            return(false);
        }
        protected override bool Skip(PropertyInfo p)
        {
            switch (p.DeclaringType.Name)
            {
            case "NSUrlSessionDownloadDelegate":
                switch (p.Name)
                {
                case "TaskResumeDataKey":
                    // This field was introduced as 64-bit only in Mavericks, and 32+64bits in Yosemite. We can't
                    // express that with our AvailabilityAttribute, we set it as available (for all architectures, since
                    // we can't distinguish them) starting with Mavericks.
                    if (Mac.Is32BitMavericks)
                    {
                        return(true);
                    }
                    break;
                }
                break;
            }

            switch (p.Name)
            {
            case "CharacteristicValidRangeString":
                return(Mac.CheckSystemVersion(10, 13));                 // radar 32858911

            // NSTableView
            case "RowViewKey":
                return(true);

            // NSBitmapImageRep
            case "CompressionMethod":
            case "CompressionFactor":
            case "DitherTransparency":
                return(true);

            // CIImage 10.8+
            case "AutoAdjustFeaturesKey":               // kCIImageAutoAdjustFeatures - documented in 10.8
            case "AutoAdjustRedEyeKey":
            case "AutoAdjustEnhanceKey":
            case "CIImagePropertiesKey":
                return(true);

            // CIImage
            case "CIImageColorSpaceKey":
                return(true);                // returns null but documented prior to 10.8

            // CLLocation 10.8+
            case "ErrorUserInfoAlternateRegionKey":                     // kCLErrorUserInfoAlternateRegionKey also returns null on iOS
                return(true);

            // NSUrl 10.8+
            case "PathKey":
                return(!Mac.CheckSystemVersion(10, 8));

            // AVMediaCharacteristic 10.8+
            case "IsMainProgramContent":
            case "IsAuxiliaryContent":
            case "ContainsOnlyForcedSubtitles":
            case "TranscribesSpokenDialogForAccessibility":
            case "DescribesMusicAndSoundForAccessibility":
            case "DescribesVideoForAccessibility":
                return(!Mac.CheckSystemVersion(10, 8));

            // AVVideo 10.8+
            case "ProfileLevelH264Main32":
                return(!Mac.CheckSystemVersion(10, 8));

            // AVMetadata 10.8+
            case "QuickTimeUserDataKeyTaggedCharacteristic":
                return(!Mac.CheckSystemVersion(10, 8));

            // CIDetector
            case "TypeFace":                    // CIDetectorTypeFace - documented as available in 10.7
            case "Accuracy":                    // CIDetectorAccuracy 10.7
            case "AccuracyLow":                 // CIDetectorAccuracyLow 10.7
            case "AccuracyHigh":                // CIDetectorAccuracyHigh 10.7
                return(true);

            // CIDetector
            case "ImageOrientation":                            // documented in 10.8
            case "Tracking":
            case "MinFeatureSize":
                return(true);

            // CGImageProperties - all new (10.7) values are missing (from pre-6 iOS too iirc)
            case "ExifCameraOwnerName":                 // kCGImagePropertyExifCameraOwnerName
            case "ExifBodySerialNumber":                // kCGImagePropertyExifBodySerialNumber
            case "ExifLensSpecification":               // kCGImagePropertyExifLensSpecification
            case "ExifLensMake":                        // kCGImagePropertyExifLensMake
            case "ExifLensModel":                       // kCGImagePropertyExifLensModel
            case "ExifLensSerialNumber":                // kCGImagePropertyExifLensSerialNumber
                return(true);

            // ACErrorDomain is _listed_ in the 10.8 Accounts Changes but like iOS it's not documented anywhere else (and does not seems to exists)
            case "ErrorDomain":
            // ACAccountStoreDidChangeNotification - documented in 10.8
            case "ChangeNotification":
            // ACAccountType - documented in 10.8
            case "Twitter":                                     // ACAccountTypeIdentifierTwitter
            case "SinaWeibo":
            case "Facebook":
            case "AppId":                                       // ACFacebookAppIdKey
            case "Permissions":                                 // ACFacebookPermissionsKey
            case "Audience":                                    // *** NOT documented in 10.8 - but part of our API enhancement
            case "Everyone":                                    // ^ MonoMac.Accounts.ACFacebookAudienceValue.Everyone
            case "Friends":                                     // ^ MonoMac.Accounts.ACFacebookAudienceValue.Friends
            case "OnlyMe":                                      // ^ MonoMac.Accounts.ACFacebookAudienceValue.OnlyMe
                return(true);

            // MonoMac.CoreServices.CFHTTPMessage - document in 10.9 but returns null
            case "_AuthenticationSchemeOAuth1":
                return(true);

            case "CBUUIDValidRangeString":
                if (Mac.CheckSystemVersion(10, 13))                  // radar 32858911
                {
                    return(true);
                }
                goto default;

#if !__UNIFIED__
            case "InputRSSArticleDurationKey":
            case "InputRSSFeedURLKey":
            case "ProtocolRSSVisualizer":
                if (Mac.CheckSystemVersion(10, 14))
                {
                    return(true);
                }
                goto default;
#endif
            default:
                return(base.Skip(p));
            }
        }
        protected override bool Skip(Type type)
        {
            switch (type.FullName)
            {
            // These should be DisableDefaultCtor but can't due to backward compat
            case "MonoMac.EventKit.EKParticipant":
            case "EventKit.EKParticipant":
            case "XamCore.CoreImage.CISampler":
            case "CoreImage.CISampler":
                return(true);

            // OSX 10.8+
            case "MonoMac.AppKit.NSSharingService":
            case "AppKit.NSSharingService":
            case "MonoMac.AppKit.NSSharingServicePicker":
            case "AppKit.NSSharingServicePicker":
            case "MonoMac.Foundation.NSUserNotification":
            case "Foundation.NSUserNotification":
            case "MonoMac.Foundation.NSUserNotificationCenter":
            case "Foundation.NSUserNotificationCenter":
            case "MonoMac.AVFoundation.AVPlayerItemVideoOutput":
            case "AVFoundation.AVPlayerItemVideoOutput":
            case "MonoMac.Foundation.NSUuid":
            case "Foundation.NSUuid":
                if (!Mac.CheckSystemVersion(10, 8))
                {
                    return(true);
                }
                break;

            // Native exception coming from [NSWindow init] which calls
            // [NSWindow initWithContentRect:styleMask:backing:defer]
            case "MonoMac.AppKit.NSWindow":
            case "AppKit.NSWindow":
                return(true);

#if !XAMCORE_2_0
            case "MonoMac.AppKit.NSToolbar":               // mono[10518:626783] *** -[__NSDictionaryM removeObjectForKey:]: key cannot be nil
            case "MonoMac.SceneKit.SCNRenderer":           // -[SCNRenderer init]: unrecognized selector sent to instance 0x7c6446c0
            case "MonoMac.SceneKit.SCNLookAtConstraint":
                return(true);
#endif
            case "MonoMac.Foundation.NSUrlSession":
            case "Foundation.NSUrlSession":
            case "MonoMac.Foundation.NSUrlSessionTask":
            case "Foundation.NSUrlSessionTask":
            case "MonoMac.Foundation.NSUrlSessionDataTask":
            case "Foundation.NSUrlSessionDataTask":
            case "MonoMac.Foundation.NSUrlSessionUploadTask":
            case "Foundation.NSUrlSessionUploadTask":
            case "MonoMac.Foundation.NSUrlSessionDownloadTask":
            case "Foundation.NSUrlSessionDownloadTask":
            case "MonoMac.Foundation.NSUrlSessionConfiguration":
            case "Foundation.NSUrlSessionConfiguration":
                // These types were introduced as 64-bit only in Mavericks, and 32+64bits in Yosemite. We can't
                // express that with our AvailabilityAttribute, we set it as available (for all architectures, since
                // we can't distinguish them) starting with Mavericks.
                if (Mac.Is32BitMavericks)
                {
                    return(true);
                }
                break;

            case "GLKit.GLKSkyboxEffect":
                // Crashes inside libGL.dylib, most likely because something hasn't been initialized yet, because
                // I can reproduce in an Xcode project if I put [[GLKSkyboxEffect alloc] init]; in main, but it doesn't
                // crash in applicationDidFinishLaunching.
                //
                //  frame #0: 0x00007fff8d570db1 libGL.dylib`glGetError + 13
                //  frame #1: 0x0000000100025542 GLKit`-[GLKEffect initWithPropertyArray:] + 1142
                //  frame #2: 0x0000000100022c2d GLKit`-[GLKSkyboxEffect init] + 493
                //
                if (IntPtr.Size == 8)
                {
                    return(true);
                }
                break;

#if !XAMCORE_3_0
            case "SpriteKit.SKView":
                // Causes a crash later. Filed as radar://18440271.
                // Apple said they won't fix this ('init' isn't a designated initializer)
                if (IntPtr.Size == 8)
                {
                    return(true);
                }
                break;
#endif

            case "MonoMac.AppKit.NSSpeechRecognizer":
            case "AppKit.NSSpeechRecognizer":
                // Makes OSX put up "a download is required for speech recognition" dialog.
                return(true);

            case "MonoMac.Foundation.NSUserActivity":
            case "Foundation.NSUserActivity":
                // Crashes by default:
                // Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Caller did not provide an activityType, and this process does not have a NSUserActivityTypes in its Info.plist.
                // but since it looks like the constructor is usable with the proper Info.plist, we can't remove it.
                return(true);
            }

            switch (type.Namespace)
            {
            // OSX 10.8+
            case "MonoMac.Accounts":
            case "Accounts":
            case "MonoMac.GameKit":
            case "GameKit":
            case "MonoMac.Social":
            case "Social":
            case "MonoMac.StoreKit":
            case "StoreKit":
                if (!Mac.CheckSystemVersion(10, 8))
                {
                    return(true);
                }
                break;

            case "SceneKit":
            case "MonoMac.SceneKit":
                if (!Mac.CheckSystemVersion(10, 8) || IntPtr.Size != 8)
                {
                    return(true);
                }
                break;
            }

            return(base.Skip(type));
        }
        // only handle exception here (to return true) otherwise call base to deal with it
        // `caller` is provided to make it easier to detect "special" cases
        protected override bool Check(char encodedType, Type type)
        {
            switch (encodedType)
            {
            case 'i':
                switch (type.FullName)
                {
                case "System.nuint":
                case "System.UInt32":
                    // sign-ness mis-binding, not critical
                    // Signature failure in MonoMac.AppKit.NSViewController presentViewController:asPopoverRelativeToRect:ofView:preferredEdge:behavior: Parameter 'preferredEdge' (#4) is encoded as 'i' and bound as 'System.UInt32'
                    return(true);

                case "GameKit.GKGameCenterViewControllerState":
                case "AppKit.NSOpenGLContextParameter":
                    // NSOpenGLContextParameter and GKGameCenterViewControllerState are anonymous enums in 10.9, but an NSInteger in 10.10.
                    if (IntPtr.Size == 8 && !Mac.CheckSystemVersion(10, 10))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            // unsigned 32 bits
            case 'I':
                switch (type.FullName)
                {
                case "System.Int32":
                    // sign-ness mis-binding, several of them (not critical)
                    // NSActionCell 'instance Int32 get_MnemonicLocation()' selector: mnemonicLocation == I8@0:4
                    // NSPathCell 'instance Int32 get_MnemonicLocation()' selector: mnemonicLocation == I8@0:4
                    // SCNText 'instance Void InsertMaterial(MonoMac.SceneKit.SCNMaterial, Int32)' selector: insertMaterial:atIndex: == v16@0:4@8I12
                    return(true);
                }
                break;

            // unsigned 32 bits
            case 'L':
                switch (type.FullName)
                {
                // sign-ness mis-binding (not critical) e.g.
                // CAMediaTimingFunction 'instance Void GetControlPointAtIndex(Int32, IntPtr)' selector: getControlPointAtIndex:values: == v16@0:4L8[2f]12
                case "System.Int32":
                    return(true);
                }
                break;

            // unsigned 64 bits
            case 'Q':
                switch (type.FullName)
                {
                // sign-ness mis-binding (not critical) e.g.
                // NSEvent 'instance Int64 get_UniqueID()' selector: uniqueID == Q8@0:4
                case "System.Int64":
                    return(true);
                }
                break;
            }
            return(base.Check(encodedType, type));
        }
Esempio n. 13
0
        protected override bool Skip(Type type, string protocolName)
        {
            switch (protocolName)
            {
            case "NSSecureCoding":
                switch (type.Name)
                {
                case "CNContactFormatter":               // iOS declares but macOS header does not. Failure was missed :(
                case "NSCachedImageRep":                 // Not declared in header file
                case "NSCIImageRep":
                case "NSCustomImageRep":
                case "NSEPSImageRep":
                case "NSBitmapImageRep":
                case "NSImageRep":
                case "NSPdfImageRep":
                case "AVAssetTrackSegment":       // Not declared in header file
                case "AVComposition":             // Not declared in header file
                case "AVMutableComposition":      // Not declared in header file
                case "AVCompositionTrackSegment": // Not declared in header file
                case "MKMapSnapshotOptions":      // Not declared in header file
                case "NSTextTab":                 // Not declared in header file
                case "NSTextList":                // Not declared in header file
                case "SFSafariPage":              // Not declared in header file
                case "SFSafariPageProperties":    // Not declared in header file
                case "SFSafariTab":               // Not declared in header file
                case "SFSafariToolbarItem":       // Not declared in header file
                case "SFSafariWindow":            // Not declared in header file
                case "SFContentBlockerState":     // Not declared in header file
                case "NEFlowMetaData":            // Not declared in header file
                case "MKMapItem":                 // Not declared in header file
                case "CAConstraintLayoutManager": // Not declared in header file
                case "NSQueryGenerationToken":    // Declared in header file but SupportsSecureCoding returns false - radar 32856944
                case "NSPersistentHistoryToken":  // Conformance not in headers
                case "NSPropertyDescription":     // NSPropertyDescription and children does not declare in header file
                case "NSAttributeDescription":
                case "NSExpressionDescription":
                case "NSFetchedPropertyDescription":
                case "NSRelationshipDescription":
                case "NSEntityDescription":               // Not declared in header file
                case "NSFetchIndexDescription":           // Not declared in header file
                case "NSFetchIndexElementDescription":    // Not declared in header file
                case "NSFetchRequest":                    // Not declared in header file
                case "NSManagedObjectModel":              // Not declared in header file
                case "NSUserInterfaceCompressionOptions": // Not declared in header file
                // Xcode 10 (running on macOS 10.14)
                case "NSTextAlternatives":
                case "QTDataReference":                 // no header files anymore for deprecated QuickTime
                case "NSTextBlock":
                case "NSTextTable":
                case "NSTextTableBlock":
                // Xcode 11 (running on macOS 10.15)
                case "LAContext":                          // Conformance not in headers
                case "ICHandle":                           // Conformance not in headers
                case "ICNotification":                     // Conformance not in headers
                case "ICNotificationManagerConfiguration": // Conformance not in headers
                case "MKPolygon":                          // Conformance not in headers
                case "MLPredictionOptions":                // Conformance not in headers
                case "NSUrlSessionTaskMetrics":            // Conformance not in headers
                case "NSUrlSessionTaskTransactionMetrics": // Conformance not in headers
                case "NSFileProviderDomain":               // Conformance not in headers
                case "FPUIActionExtensionContext":         // Conformance not in headers
                    return(true);

                // macOS 10.15.2
                case "NSPrintInfo":               // Conformance not in headers
                case "NSPrinter":                 // Conformance not in headers
                    return(true);

                default:
                    // CIFilter started implementing NSSecureCoding in 10.11
                    if (!Mac.CheckSystemVersion(10, 11) && (type == typeof(CIFilter) || type.IsSubclassOf(typeof(CIFilter))))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "NSCopying":
                switch (type.Name)
                {
                case "WKPreferences":              // Not declared in header file
                case "DomNodeFilter":              // Not declared in header file
                case "MKDirectionsRequest":        // Not declared in header file
                case "EKObject":                   // Not declared in header file
                case "EKCalendarItem":             // Not declared in header file
                case "EKSource":                   // Not declared in header file
                case "EKCalendar":                 // Not declared in header file
                case "EKEvent":                    // Not declared in header file
                case "EKReminder":                 // Not declared in header file
                case "ACAccount":                  // Not declared in header file
                case "NEFlowMetaData":             // Not declared in header file
                case "ACAccountCredential":        // Not declared in header file
                // Xcode 11 (running on macOS 10.15)
                case "NSCollectionViewUpdateItem": // Not declared in header file
                case "MLPredictionOptions":        // Not declared in header file
                case "FPUIActionExtensionContext": // Conformance not in headers
                    return(true);
                }
                break;

            case "NSMutableCopying":
                switch (type.Name)
                {
                case "EKObject":                // Not declared in header file
                case "EKCalendarItem":          // Not declared in header file
                case "EKSource":                // Not declared in header file
                case "EKStructuredLocation":    // Not declared in header file
                case "EKAlarm":                 // Not declared in header file
                case "EKCalendar":              // Not declared in header file
                case "EKEvent":                 // Not declared in header file
                case "EKParticipant":           // Not declared in header file
                case "EKRecurrenceRule":        // Not declared in header file
                case "EKReminder":              // Not declared in header file
                case "INPerson":                // Not declared in header file
                    return(true);
                }
                break;

            case "NSCoding":
                switch (type.Name)
                {
                case "EKObject":                  // Not declared in header file
                case "EKCalendarItem":            // Not declared in header file
                case "EKSource":                  // Not declared in header file
                case "EKStructuredLocation":      // Not declared in header file
                case "EKAlarm":                   // Not declared in header file
                case "EKCalendar":                // Not declared in header file
                case "EKEvent":                   // Not declared in header file
                case "EKParticipant":             // Not declared in header file
                case "EKRecurrenceRule":          // Not declared in header file
                case "EKReminder":                // Not declared in header file
                case "AVAssetTrackSegment":       // Not declared in header file
                case "AVComposition":             // Not declared in header file
                case "AVMutableComposition":      // Not declared in header file
                case "AVCompositionTrackSegment": // Not declared in header file
                case "MKMapSnapshotOptions":      // Not declared in header file
                case "SFContentBlockerState":     // Not declared in header file
                case "SFSafariPage":              // Not declared in header file
                case "SFSafariPageProperties":    // Not declared in header file
                case "SFSafariTab":               // Not declared in header file
                case "SFSafariToolbarItem":       // Not declared in header file
                case "SFSafariWindow":            // Not declared in header file
                case "NEFlowMetaData":            // Not declared in header file
                case "MKMapItem":                 // Not declared in header file
                case "NSConstraintConflict":      // Not declared in header file
                case "NSQueryGenerationToken":    // Declared in header file but SupportsSecureCoding returns false - radar 32856944
                case "NSPersistentHistoryToken":  // Conformance not in headers
                // Xcode 10 (running on macOS 10.14)
                case "NSTextAlternatives":
                // Xcode 11 (running on macOS 10.15)
                case "ICHandle":                           // Conformance not in headers
                case "ICNotification":                     // Conformance not in headers
                case "ICNotificationManagerConfiguration": // Conformance not in headers
                case "LAContext":                          // Conformance not in headers
                case "MKPolygon":                          // Conformance not in headers
                case "MLPredictionOptions":                // Conformance not in headers
                case "NSUrlSessionTaskMetrics":            // Conformance not in headers
                case "NSUrlSessionTaskTransactionMetrics": // Conformance not in headers
                case "NSFileProviderDomain":               // Conformance not in headers
                case "FPUIActionExtensionContext":         // Conformance not in headers
                    return(true);
                }
                break;

            case "NSWindowRestoration":
                switch (type.Name)
                {
                case "NSDocumentController":
                    // There's a category that implements the NSWindowRestoration protocol for NSDocumentController,
                    // but that apparently doesn't make conformsToProtocol: return true.
                    // '@interface NSDocumentController (NSWindowRestoration) <NSWindowRestoration>'
                    return(true);
                }
                break;

            case "NSUserInterfaceItemIdentification":
                // NSViewController started implementing NSUserInterfaceItemIdentification in 10.10
                if (!Mac.CheckSystemVersion(10, 10) && (type == typeof(NSViewController) || type.IsSubclassOf(typeof(NSViewController))))
                {
                    return(true);
                }

                switch (type.Name)
                {
                case "NSMenuItem":
                    if (!Mac.CheckSystemVersion(10, 12))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "NSMenuDelegate":
                switch (type.Name)
                {
                case "PdfView":
                    if (!Mac.CheckSystemVersion(10, 10))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "NSTextFinderClient":             // Not listed in header, nor conformsToProtocol, but works in sample. But it just repondsToSelectors
                if (type.Name == "NSTextView")
                {
                    return(true);
                }
                break;

#if !XAMCORE_4_0
            case "NSDraggingInfo":
                return(true);                // We have to keep the type to maintain backwards compatibility.
#endif
            case "NSAccessibility":
            case "NSAccessibilityElement":
                switch (type.Name)
                {
                case "NSMenu":
                case "NSMenuItem":
                    if (!Mac.CheckSystemVersion(10, 12))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "NSAnimationDelegate":
            case "NSAnimatablePropertyContainer":
                switch (type.Name)
                {
                case "NSTitlebarAccessoryViewController":
                    return(true);
                }
                break;

            case "NSCandidateListTouchBarItemDelegate":
            case "NSTouchBarDelegate":
                switch (type.Name)
                {
                case "NSTextView":
                    return(true);
                }
                break;

            case "NSExtensionRequestHandling":
                return(IntPtr.Size == 4);

            case "NSAppearanceCustomization":
                switch (type.Name)
                {
                case "NSPopover":
                    if (!Mac.CheckSystemVersion(10, 13) || IntPtr.Size == 4)                      // Was added in 10.13
                    {
                        return(true);
                    }
                    break;

                case "NSApplication":
                    if (!Mac.CheckSystemVersion(10, 14))                      // Was added in 10.14
                    {
                        return(true);
                    }
                    break;

                case "NSMenu":
                    if (!Mac.CheckSystemVersion(11, 0))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "NSUserInterfaceValidations":
                switch (type.Name)
                {
                case "NSSplitViewController":
                    if (!Mac.CheckSystemVersion(10, 13))                      // Was added in 10.13
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "NSItemProviderWriting":
                switch (type.Name)
                {
                case "NSMutableString":
                case "NSString":
                case "NSUrl":
                    if (IntPtr.Size == 4)                     // Only on 64-bit version of these types
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "CAAction":
                switch (type.Name)
                {
                case "NSNull":
                    if (!Mac.CheckSystemVersion(10, 11))                      // NSNull started implementing the CAAction protocol in 10.11
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "NSTextContent":
                switch (type.Name)
                {
                case "NSTextField":
                case "NSTextView":
                case "NSTokenField":
                case "NSComboBox":
                case "NSSearchField":
                case "NSSecureTextField":
                    if (!Mac.CheckSystemVersion(11, 0))
                    {
                        return(true);
                    }
                    break;
                }
                break;
            }

            switch (type.Name)
            {
#if !XAMCORE_3_0
            case "NSRemoteSavePanel":
            case "NSRemoteOpenPanel":
                return(true);                // These two classes don't show up in any documentation.
#endif
            }

            switch (type.Namespace)
            {
            case "MonoMac.SceneKit":
            case "SceneKit":
                // skip on 32 bits but continue otherwise
                if (IntPtr.Size == 4)
                {
                    return(true);
                }
                break;
            }

            return(base.Skip(type, protocolName));
        }
Esempio n. 14
0
        protected override bool Skip(Type type, string protocolName)
        {
            switch (protocolName)
            {
            case "NSSecureCoding":
                switch (type.Name)
                {
                case "NSCachedImageRep":                 // Not declared in header file
                case "NSCIImageRep":
                case "NSCustomImageRep":
                case "NSEPSImageRep":
                case "NSBitmapImageRep":
                case "NSImageRep":
                case "NSPdfImageRep":
                case "AVAssetTrackSegment":       // Not declared in header file
                case "AVComposition":             // Not declared in header file
                case "AVMutableComposition":      // Not declared in header file
                case "AVCompositionTrackSegment": // Not declared in header file
                case "MKMapSnapshotOptions":      // Not declared in header file
                case "NSTextTab":                 // Not declared in header file
                case "NSTextList":                // Not declared in header file
                case "SFSafariPage":              // Not declared in header file
                case "SFSafariPageProperties":    // Not declared in header file
                case "SFSafariTab":               // Not declared in header file
                case "SFSafariToolbarItem":       // Not declared in header file
                case "SFSafariWindow":            // Not declared in header file
                case "SFContentBlockerState":     // Not declared in header file
                case "NEFlowMetaData":            // Not declared in header file
                    return(true);

                default:
                    // CIFilter started implementing NSSecureCoding in 10.11
                    if (!Mac.CheckSystemVersion(10, 11) && (type == typeof(CIFilter) || type.IsSubclassOf(typeof(CIFilter))))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "NSCopying":
                switch (type.Name)
                {
                case "DomNodeFilter":           // Not declared in header file
                case "MKDirectionsRequest":     // Not declared in header file
                case "EKObject":                // Not declared in header file
                case "EKCalendarItem":          // Not declared in header file
                case "EKSource":                // Not declared in header file
                case "EKCalendar":              // Not declared in header file
                case "EKEvent":                 // Not declared in header file
                case "EKReminder":              // Not declared in header file
                case "ACAccount":               // Not declared in header file
                case "NEFlowMetaData":          // Not declared in header file
                    return(true);
                }
                break;

            case "NSMutableCopying":
                switch (type.Name)
                {
                case "EKObject":                // Not declared in header file
                case "EKCalendarItem":          // Not declared in header file
                case "EKSource":                // Not declared in header file
                case "EKStructuredLocation":    // Not declared in header file
                case "EKAlarm":                 // Not declared in header file
                case "EKCalendar":              // Not declared in header file
                case "EKEvent":                 // Not declared in header file
                case "EKParticipant":           // Not declared in header file
                case "EKRecurrenceRule":        // Not declared in header file
                case "EKReminder":              // Not declared in header file
                    return(true);
                }
                break;

            case "NSCoding":
                switch (type.Name)
                {
                case "EKObject":                  // Not declared in header file
                case "EKCalendarItem":            // Not declared in header file
                case "EKSource":                  // Not declared in header file
                case "EKStructuredLocation":      // Not declared in header file
                case "EKAlarm":                   // Not declared in header file
                case "EKCalendar":                // Not declared in header file
                case "EKEvent":                   // Not declared in header file
                case "EKParticipant":             // Not declared in header file
                case "EKRecurrenceRule":          // Not declared in header file
                case "EKReminder":                // Not declared in header file
                case "AVAssetTrackSegment":       // Not declared in header file
                case "AVComposition":             // Not declared in header file
                case "AVMutableComposition":      // Not declared in header file
                case "AVCompositionTrackSegment": // Not declared in header file
                case "MKMapSnapshotOptions":      // Not declared in header file
                case "SFContentBlockerState":     // Not declared in header file
                case "SFSafariPage":              // Not declared in header file
                case "SFSafariPageProperties":    // Not declared in header file
                case "SFSafariTab":               // Not declared in header file
                case "SFSafariToolbarItem":       // Not declared in header file
                case "SFSafariWindow":            // Not declared in header file
                case "NEFlowMetaData":            // Not declared in header file
                    return(true);
                }
                break;

            case "NSWindowRestoration":
                switch (type.Name)
                {
                case "NSDocumentController":
                    // There's a category that implements the NSWindowRestoration protocol for NSDocumentController,
                    // but that apparently doesn't make conformsToProtocol: return true.
                    // '@interface NSDocumentController (NSWindowRestoration) <NSWindowRestoration>'
                    return(true);
                }
                break;

            case "NSUserInterfaceItemIdentification":
                // NSViewController started implementing NSUserInterfaceItemIdentification in 10.10
                if (!Mac.CheckSystemVersion(10, 10) && (type == typeof(NSViewController) || type.IsSubclassOf(typeof(NSViewController))))
                {
                    return(true);
                }

                switch (type.Name)
                {
                case "NSMenuItem":
                    if (!Mac.CheckSystemVersion(10, 12))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "NSMenuDelegate":
                switch (type.Name)
                {
                case "PdfView":
                    if (!Mac.CheckSystemVersion(10, 10))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "NSTextFinderClient":             // Not listed in header, nor conformsToProtocol, but works in sample. But it just repondsToSelectors
                if (type.Name == "NSTextView")
                {
                    return(true);
                }
                break;

#if !XAMCORE_4_0
            case "NSDraggingInfo":
                return(true);                // We have to keep the type to maintain backwards compatibility.
#endif
            case "NSAccessibility":
            case "NSAccessibilityElement":
                switch (type.Name)
                {
                case "NSMenu":
                case "NSMenuItem":
                    if (!Mac.CheckSystemVersion(10, 12))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "NSAnimationDelegate":
            case "NSAnimatablePropertyContainer":
                switch (type.Name)
                {
                case "NSTitlebarAccessoryViewController":
                    return(true);
                }
                break;

            case "NSCandidateListTouchBarItemDelegate":
            case "NSTouchBarDelegate":
                switch (type.Name)
                {
                case "NSTextView":
                    return(true);
                }
                break;

            case "NSExtensionRequestHandling":
                return(IntPtr.Size == 4);
            }

            switch (type.Name)
            {
#if !XAMCORE_3_0
            case "NSRemoteSavePanel":
            case "NSRemoteOpenPanel":
                return(true);                // These two classes don't show up in any documentation.
#endif
            }

            switch (type.Namespace)
            {
            case "MonoMac.SceneKit":
            case "SceneKit":
                return(IntPtr.Size == 4);                // 64bits should be fine
            }

            return(base.Skip(type, protocolName));
        }
Esempio n. 15
0
        protected override bool CheckResponse(bool value, Type actualType, MethodBase method, ref string name)
        {
            var declaredType = method.DeclaringType;

            switch (name)
            {
            // NSDraggingDestination protocol
            case "concludeDragOperation:":                      // e.g. NSTokenField
            case "draggingEnded:":                              // e.g. NSMatrix
            case "draggingExited:":                             // e.g. NSTokenField
            case "draggingUpdated:":                            // e.g. NSTokenField
            case "performDragOperation:":                       // e.g. NSTokenField
            case "prepareForDragOperation:":                    // e.g. NSTokenField
            case "wantsPeriodicDraggingUpdates":                // e.g. NSBrowser - optional, [DefaultValue(true)] if it does not exists
                return(true);

            // NSDraggingSource
            case "draggedImage:beganAt:":                                       // e.g. NSTextView
            case "draggedImage:endedAt:deposited:":                             // e.g. NSTableView
            case "draggedImage:movedTo:":                                       // e.g. NSCollectionView
            case "ignoreModifierKeysWhileDragging":                             // e.g. NSTextView
            case "namesOfPromisedFilesDroppedAtDestination:":                   // e.g. NSTextView
                return(true);

            // NSAnimatablePropertyContainer
            case "animationForKey:":                            // e.g. NSViewAnimation
            case "animator":
            case "animations":
            case "setAnimations:":
                return(true);

            // NSTypeSetter - Layout Phase Interface (needs to be overridden, not really part of the provided types)
            case "willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:":
            case "shouldBreakLineByWordBeforeCharacterAtIndex:":
            case "shouldBreakLineByHyphenatingBeforeCharacterAtIndex:":
            case "hyphenationFactorForGlyphAtIndex:":
            case "hyphenCharacterForGlyphAtIndex:":
            case "boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:":
                return(true);

            // in NSView documentation but defined in NSClipView - no answers to call
            case "scrollClipView:toPoint:":
                return(true);

            // IKFilterBrowserPanel ??? not clear why
            case "finish:":
                return(true);

            // IKFilterUIView
            case "viewForUIConfiguration:excludedKeys:":                // [Target] on CIFilter
                return(true);

            // NSDictionaryEnumerator
            case "fileModificationDate":
            case "fileType":
            case "filePosixPermissions":
            case "fileOwnerAccountName":
            case "fileGroupOwnerAccountName":
            case "fileSystemNumber":
            case "fileSystemFileNumber":
            case "fileExtensionHidden":
            case "fileHFSCreatorCode":
            case "fileHFSTypeCode":
            case "fileIsImmutable":
            case "fileIsAppendOnly":
            case "fileCreationDate":
            case "fileOwnerAccountID":
            case "fileGroupOwnerAccountID":
                return(true);                                           // all [Target] on NSDictionary

            // SBObject
            case "get":
                return(true);

            // NSCoder - documented as available in 10.8
            case "allowedClasses":
            case "requiresSecureCoding":
                return(true);

            // NSFileManager
            case "ubiquityIdentityToken":                       // documented in 10.8
                return(true);

            // NS[Mutable]UrlRequest
            case "allowsCellularAccess":                        // documented in 10.8
            case "setAllowsCellularAccess:":                    // documented in 10.8
                return(true);

            // NSString
            case "capitalizedStringWithLocale:":                // documented in 10.8
            case "lowercaseStringWithLocale:":                  // documented in 10.8
            case "uppercaseStringWithLocale:":                  // documented in 10.8
                return(true);

            // AVVideoComposition
            case "isValidForAsset:timeRange:validationDelegate:":               // documented in 10.8
                return(true);

            // AVPlayer
            case "setRate:time:atHostTime:":         // 10.8+
            case "prerollAtRate:completionHandler:": // 10.8+
            case "cancelPendingPrerolls":            // 10.8+
            case "masterClock":                      // 10.8+
            case "setMasterClock:":                  // 10.8+
            // NSDateComponents
            case "isLeapMonth":                      // 10.8+
            case "setLeapMonth:":                    // 10.8+
            // NSFileCoordinator
            case "itemAtURL:willMoveToURL:":         // 10.8+
                return(true);                        // documented (but does not respond)

            // MonoMac.CoreImage.CIDetector (10.8+)
            case "featuresInImage:options:":
            // MonoMac.CoreImage.CIFaceFeature (10.8+)
            case "hasTrackingID":
            case "trackingID":
            case "hasTrackingFrameCount":
            case "trackingFrameCount":
            // MonoMac.CoreImage.CIImage : only in 10.8+
            case "properties":             // only documented in header files
            case "autoAdjustmentFilters":
            case "autoAdjustmentFiltersWithOptions:":
            // MonoMac.AVFoundation.AVAssetExportSession (10.8+)
            case "asset":
            // MonoMac.AVFoundation.AVAssetReaderOutput
            case "alwaysCopiesSampleData":
            case "setAlwaysCopiesSampleData:":
            // MonoMac.AVFoundation.AVAssetTrack
            case "isPlayable":
            // MonoMac.AVFoundation.AVAudioPlayer (10.8+)
            case "enableRate":
            case "setEnableRate:":
            case "rate":
            case "setRate:":
            // MonoMac.AVFoundation.AVMutableCompositionTrack
            case "insertTimeRanges:ofTracks:atTime:error:":
            // MonoMac.AVFoundation.AVPlayerItem
            case "addOutput:":
            case "removeOutput:":
            case "canPlayFastReverse":
            case "canPlayFastForward":
            case "canPlaySlowForward":
            case "canPlayReverse":
            case "canPlaySlowReverse":
            case "canStepForward":
            case "canStepBackward":
            case "outputs":
            case "timebase":
            // MonoMac.CoreAnimation.CAAnimation : only on OSX, added for SceneKit
            case "usesSceneTimeBase":
            case "setUsesSceneTimeBase:":
                if (!Mac.CheckSystemVersion(10, 8))
                {
                    return(true);
                }
                break;

            case "initWithString:":
                if (declaredType.Name == "NSTextStorage")
                {
                    return(true);
                }
                break;
            }

            switch (declaredType.Name)
            {
            case "NSUrlSession":
            case "Foundation.NSUrlSession":
                switch (name)
                {
                case "delegateQueue":
                case "sessionDescription":
                case "setSessionDescription:":
                case "delegate":
                    if (!Mac.CheckSystemVersion(10, 11))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "NSUrlSessionTask":
            case "Foundation.NSUrlSessionTask":
                switch (name)
                {
                case "countOfBytesExpectedToReceive":
                case "countOfBytesExpectedToSend":
                case "countOfBytesReceived":
                case "countOfBytesSent":
                case "currentRequest":
                case "error":
                case "originalRequest":
                case "response":
                case "state":
                case "taskDescription":
                case "setTaskDescription:":
                case "taskIdentifier":
                case "priority":
                case "setPriority:":
                    if (!Mac.CheckSystemVersion(10, 11))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "Foundation.NSUrlSessionStreamTask":
            case "NSUrlSessionStreamTask":
                switch (name)
                {
                case "captureStreams":
                case "closeRead":
                case "closeWrite":
                case "readDataOfMinLength:maxLength:timeout:completionHandler:":
                case "startSecureConnection":
                case "stopSecureConnection":
                case "writeData:timeout:completionHandler:":
                    if (!Mac.CheckSystemVersion(10, 11))
                    {
                        return(true);
                    }
                    break;
                }
                break;
            }

//			Console.WriteLine ("{0} {1}", declaredType, name);
            return(base.CheckResponse(value, actualType, method, ref name));
        }
Esempio n. 16
0
        protected override bool Skip(Type type)
        {
            switch (type.FullName)
            {
            case "MonoMac.CIFilter.CIMaskedVariableBlur":             // Appears to be missing from 10.11, not documented
            case "CIFilter.CIMaskedVariableBlur":
                if (Mac.CheckSystemVersion(10, 11))
                {
                    return(true);
                }
                break;

            case "MonoMac.Foundation.NSUrlSession":
            case "Foundation.NSUrlSession":
            case "MonoMac.Foundation.NSUrlSessionTask":
            case "Foundation.NSUrlSessionTask":
            case "MonoMac.Foundation.NSUrlSessionDataTask":
            case "Foundation.NSUrlSessionDataTask":
            case "MonoMac.Foundation.NSUrlSessionUploadTask":
            case "Foundation.NSUrlSessionUploadTask":
            case "MonoMac.Foundation.NSUrlSessionDownloadTask":
            case "Foundation.NSUrlSessionDownloadTask":
            case "MonoMac.Foundation.NSUrlSessionConfiguration":
            case "Foundation.NSUrlSessionConfiguration":
                // These classes are available in 32-bit Yosemite, or 32+64bit Mavericks.
                if (IntPtr.Size == 4 && !Mac.CheckSystemVersion(10, 10))
                {
                    return(true);
                }
                break;

            case "MonoMac.AppKit.NSSharingService":
            case "AppKit.NSSharingService":
            case "MonoMac.AppKit.NSSharingServicePicker":
            case "AppKit.NSSharingServicePicker":
            case "MonoMac.Foundation.NSByteCountFormatter":
            case "Foundation.NSByteCountFormatter":
            case "MonoMac.Foundation.NSUserNotification":
            case "Foundation.NSUserNotification":
            case "MonoMac.Foundation.NSUserNotificationCenter":
            case "Foundation.NSUserNotificationCenter":
            case "MonoMac.AVFoundation.AVPlayerItemOutput":
            case "AVFoundation.AVPlayerItemOutput":
            case "MonoMac.AVFoundation.AVPlayerItemVideoOutput":
            case "AVFoundation.AVPlayerItemVideoOutput":
            case "MonoMac.Foundation.NSUuid":
            case "Foundation.NSUuid":
                if (!Mac.CheckSystemVersion(10, 8))
                {
                    return(true);
                }
                break;
            }

            switch (type.Namespace)
            {
            // OSX 10.8+
            case "MonoMac.Accounts":
            case "Accounts":
            case "MonoMac.GameKit":
            case "GameKit":
            case "MonoMac.Social":
            case "Social":
            case "MonoMac.StoreKit":
            case "StoreKit":
                if (!Mac.CheckSystemVersion(10, 8))
                {
                    return(true);
                }
                break;

            case "SceneKit":
            case "MonoMac.SceneKit":
                if (!Mac.CheckSystemVersion(10, 8) || IntPtr.Size != 8)
                {
                    return(true);
                }
                break;

            // not installed by default
            case "MonoMac.Growl":
            case "Growl":
                return(true);
            }

            return(base.Skip(type));
        }
Esempio n. 17
0
        protected override bool Skip(Type type, string selectorName)
        {
            switch (selectorName)
            {
            case "accessibilityNotifiesWhenDestroyed":
                // The header declares this on an NSObject category but
                // it doesn't even respondsToSelector on NSView/NSCell...
                return(true);

#if !XAMCORE_4_0
            case "xamarinselector:removed:":
                return(true);
#endif
#if !XAMCORE_3_0
            case "initWithPasteboardPropertyList:ofType:":
                // This is a broken binding, but it's an abstract protocol
                // method, so there's no way to remove it without breaking
                // compat.
                return(true);
#endif
            case "waitUntilExit":
                // category, NSTask won't respond -> @interface NSTask (NSTaskConveniences)
                if (type.Name == "NSTask")
                {
                    return(true);
                }
                break;

            case "readInBackgroundAndNotifyForModes:":
            case "readInBackgroundAndNotify":
            case "readToEndOfFileInBackgroundAndNotifyForModes:":
            case "readToEndOfFileInBackgroundAndNotify":
            case "acceptConnectionInBackgroundAndNotifyForModes:":
            case "acceptConnectionInBackgroundAndNotify":
            case "waitForDataInBackgroundAndNotifyForModes:":
            case "waitForDataInBackgroundAndNotify":
                // category, NSFileHandle won't respond -> @interface NSFileHandle (NSFileHandleAsynchronousAccess)
                if (type.Name == "NSFileHandle")
                {
                    return(true);
                }
                break;

            // initWithPlayerIDs: works (valid handle) and is documented - but does not respond when queried
            case "initWithPlayerIDs:":
                if (type.Name == "GKLeaderboard")
                {
                    return(true);
                }
                break;

            // some types had NSCopying added after they were first introduced
            case "copyWithZone:":
                if (type.Name == "CBPeripheral" && !Mac.CheckSystemVersion(10, 9))
                {
                    return(true);
                }
                break;

            case "readingOptionsForType:pasteboard:":
            case "writingOptionsForType:pasteboard:":
                return(true);                // Optional selectors on NSPasteboardReading/NSPasteboardWriting
            }

            switch (type.Namespace)
            {
            // Notifications seems to follow a pattern were selectors are routed to an internal concrete type
            case "MonoMac.Foundation":
            case "Foundation":
                switch (type.Name)
                {
                // looks like it's routed to (private) NSConcreteUserNotificationCenter
                case "NSUserNotificationCenter":
                    switch (selectorName)
                    {
                    case "delegate":
                    case "setDelegate:":
                    case "scheduledNotifications":
                    case "setScheduledNotifications:":
                    case "deliveredNotifications":
                        return(true);
                    }
                    break;

                // looks like it's routed to (private) NSConcreteUserNotification
                case "NSUserNotification":
                    switch (selectorName)
                    {
                    case "title":
                    case "setTitle:":
                    case "subtitle":
                    case "setSubtitle:":
                    case "informativeText":
                    case "setInformativeText:":
                    case "actionButtonTitle":
                    case "setActionButtonTitle:":
                    case "userInfo":
                    case "setUserInfo:":
                    case "deliveryDate":
                    case "setDeliveryDate:":
                    case "deliveryTimeZone":
                    case "setDeliveryTimeZone:":
                    case "deliveryRepeatInterval":
                    case "setDeliveryRepeatInterval:":
                    case "actualDeliveryDate":
                    case "isPresented":
                    case "isRemote":
                    case "soundName":
                    case "setSoundName:":
                    case "hasActionButton":
                    case "setHasActionButton:":
                    case "activationType":
                    case "otherButtonTitle":
                    case "setOtherButtonTitle:":
                        return(true);
                    }
                    break;

                case "NSFileHandle":                 //Fails on Lion
                case "NSUrlAuthenticationChallenge":
                case "NSUrlCredential":
                case "NSUrlProtectionSpace":
                case "NSAppleEventDescriptor":
                    if (selectorName == "encodeWithCoder:" && !Mac.CheckSystemVersion(10, 8))
                    {
                        return(true);
                    }
                    break;

                case "NSValue":
                    switch (selectorName)
                    {
                    case "SCNMatrix4Value":
                    case "SCNVector3Value":
                    case "SCNVector4Value":
                    case "valueWithSCNMatrix4:":
                        if (IntPtr.Size != 8)
                        {
                            return(true);
                        }
                        break;
                    }
                    break;

                case "NSUrlSession":
                    switch (selectorName)
                    {
                    case "delegateQueue":
                    case "sessionDescription":
                    case "setSessionDescription:":
                    case "delegate":
                        if (Mac.CheckSystemVersion(10, 11))
                        {
                            return(true);
                        }
                        break;
                    }
                    break;

                case "NSUrlSessionStreamTask":
                    switch (selectorName)
                    {
                    case "captureStreams":
                    case "closeRead":
                    case "closeWrite":
                    case "readDataOfMinLength:maxLength:timeout:completionHandler:":
                    case "startSecureConnection":
                    case "stopSecureConnection":
                    case "writeData:timeout:completionHandler:":
                        if (Mac.CheckSystemVersion(10, 11))
                        {
                            return(true);
                        }
                        break;
                    }
                    break;

                case "NSUrlSessionTask":
                    switch (selectorName)
                    {
                    case "countOfBytesExpectedToReceive":
                    case "countOfBytesExpectedToSend":
                    case "countOfBytesReceived":
                    case "countOfBytesSent":
                    case "currentRequest":
                    case "error":
                    case "originalRequest":
                    case "response":
                    case "state":
                    case "taskDescription":
                    case "setTaskDescription:":
                    case "taskIdentifier":
                        if (Mac.CheckSystemVersion(10, 11))
                        {
                            return(true);
                        }
                        break;
                    }
                    break;

                case "NSUrlSessionConfiguration":
                    if (Mac.IsAtLeast(10, 11))
                    {
                        return(true);
                    }
                    break;
                }
                break;

            case "MonoMac.AppKit":
            case "AppKit":
                switch (type.Name)
                {
#if !XAMCORE_3_0                // These should be not be marked [Abstract] but can't fix w/o breaking change...
                case "NSScrollView":
                case "NSTextView":
                    switch (selectorName)
                    {
                    case "contentViewAtIndex:effectiveCharacterRange:":
                    case "didReplaceCharacters":
                    case "drawCharactersInRange:forContentView:":
                    case "rectsForCharacterRange:":
                    case "replaceCharactersInRange:withString:":
                    case "scrollRangeToVisible:":
                    case "shouldReplaceCharactersInRanges:withStrings:":
                    case "stringAtIndex:effectiveRange:endsWithSearchBoundary:":
                    case "stringLength":
                    case "allowsMultipleSelection":
                    case "isEditable":
                    case "firstSelectedRange":
                    case "isSelectable":
                    case "selectedRanges":
                    case "setSelectedRanges:":
                    case "string":
                    case "visibleCharacterRanges":
                        return(true);
                    }
                    break;
#endif
                case "NSMenuDelegate":
                    switch (selectorName)
                    {
#if !XAMCORE_3_0
                    case "menu:willHighlightItem:":
                        return(true);                        // bound
#endif
                    }
                    break;

                case "NSResponder":
                    switch (selectorName)
                    {
                    case "smartMagnifyWithEvent:":
                    case "quickLookWithEvent:":
                        if (!Mac.CheckSystemVersion(10, 8))
                        {
                            return(true);
                        }
                        break;
                    }
                    break;

                case "NSViewController":
                    switch (selectorName)
                    {
                    case "identifier":                     //
                    case "setIdentifier:":
                        // In Yosemite (but not before) NSViewController implements the NSUserInterfaceItemIdentification
                        // protocol (which brings a r/w Identifier property). We don't have any way of expressing that
                        // a type started implementing a protocol in a particular version, so just ignore these selectors.
                        if (!Mac.CheckSystemVersion(10, 10))
                        {
                            return(true);
                        }
                        break;
                    }
                    break;
                }
                break;

            // GameKit seems to follow a pattern were selectors are routed to an internal concrete type
            case "MonoMac.GameKit":
            case "GameKit":
                switch (type.Name)
                {
                case "GKTurnBasedExchange":
                    switch (selectorName)
                    {
                    case "completionDate":
                    case "data":
                    case "exchangeID":
                    case "sendDate":
                    case "timeoutDate":
                        return(true);
                    }
                    break;

                case "GKTurnBasedExchangeReply":
                    switch (selectorName)
                    {
                    case "data":
                    case "replyDate":
                        return(true);
                    }
                    break;

                // looks like it's routed to (private) GKDialogController_Concrete
                case "GKDialogController":
                    switch (selectorName)
                    {
                    case "parentWindow":
                    case "setParentWindow:":
                        return(true);
                    }
                    break;

                // looks like it's routed to (private) GKVoiceChat_Concrete
                case "GKVoiceChat":
                    switch (selectorName)
                    {
                    case "start":
                    case "stop":
                    case "setMute:forPlayer:":
                    case "name":
                    case "isActive":
                    case "setActive:":
                    case "volume":
                    case "setVolume:":
                    case "playerStateUpdateHandler":
                    case "setPlayerStateUpdateHandler:":
                    case "playerIDs":
                        return(true);
                    }
                    break;

                // looks like it's routed to (private) GKLeaderboard_Concrete
                case "GKLeaderboard":
                    switch (selectorName)
                    {
                    case "loadScoresWithCompletionHandler:":
                    case "timeScope":
                    case "setTimeScope:":
                    case "playerScope":
                    case "setPlayerScope:":
                    case "maxRange":
                    case "category":
                    case "setCategory:":
                    case "title":
                    case "range":
                    case "setRange:":
                    case "scores":
                    case "localPlayerScore":
                    case "groupIdentifier":
                    case "setGroupIdentifier:":
                        return(true);
                    }
                    break;

                // looks like it's routed to (private) GKLeaderboard_Concrete
                case "GKLocalPlayer":
                    switch (selectorName)
                    {
                    case "authenticateWithCompletionHandler:":
                    case "loadDefaultLeaderboardCategoryIDWithCompletionHandler:":
                    case "setDefaultLeaderboardCategoryID:completionHandler:":
                    case "authenticateHandler":
                    case "setAuthenticateHandler:":
                    case "loadFriendsWithCompletionHandler:":
                    case "isAuthenticated":
                        return(true);
                    }
                    break;

                // looks like it's routed to (private) GKMatch_Concrete
                case "GKMatch":
                    switch (selectorName)
                    {
                    case "sendData:toPlayers:withDataMode:error:":
                    case "sendDataToAllPlayers:withDataMode:error:":
                    case "disconnect":
                    case "voiceChatWithName:":
                    case "playerIDs":
                    case "delegate":
                    case "setDelegate:":
                    case "expectedPlayerCount":
                        return(true);
                    }
                    break;

                // looks like it's routed to (private) GKMatchmater_Concrete
                case "GKMatchmaker":
                    switch (selectorName)
                    {
                    case "inviteHandler":
                    case "setInviteHandler:":
                    case "findMatchForRequest:withCompletionHandler:":
                    case "findPlayersForHostedMatchRequest:withCompletionHandler:":
                    case "addPlayersToMatch:matchRequest:completionHandler:":
                    case "cancel":
                    case "queryPlayerGroupActivity:withCompletionHandler:":
                    case "queryActivityWithCompletionHandler:":
                        return(true);
                    }
                    break;
                }
                break;

            // Gone in Mavericks
            case "MonoMac.StoreKit":
            case "StoreKit":
                switch (type.Name)
                {
                case "SKPayment":
                case "SKMutablePayment":
                    switch (selectorName)
                    {
                    case "paymentWithProductIdentifier:":
                        if (Mac.CheckSystemVersion(10, 9))
                        {
                            return(true);
                        }
                        break;
                    }
                    break;
                }
                break;

            case "MonoMac.PdfKit":             // Bug 20232
            case "PdfKit":
                switch (type.Name)
                {
                case "PdfBorder":                 // Fails on Lion
                case "PdfAnnotation":
                    if (selectorName == "encodeWithCoder:" && !Mac.CheckSystemVersion(10, 8))
                    {
                        return(true);
                    }
                    break;

                case "PdfView":
                    switch (selectorName)
                    {
#if !XAMCORE_3_0
                    case "menu:willHighlightItem:":
                        return(true);
#endif
                    }
                    break;
                }
                break;

            case "MonoMac.SceneKit":
            case "SceneKit":
                switch (type.Name)
                {
                case "SCNGeometryElement":
                    // Ignore on 10.8 where SCNGeometryPrimitiveType is int (32), but
                    // on 10.9+ is NSInteger/nint (32/64). SceneKit is next to useless
                    // on 10.8 anyway. -abock
                    if (selectorName == "primitiveType" && Mac.CheckSystemVersion(10, 8))
                    {
                        return(true);
                    }
                    // fall through
                    goto case "SCNCamera";

                case "SCNCamera":
                case "SCNGeometry":
                case "SCNGeometrySource":
                case "SCNLight":
                case "SCNMaterial":
                case "SCNMaterialProperty":
                case "SCNNode":
                case "SCNProgram":
                case "SCNScene":
                case "SCNMorpher":
                case "SCNSkinner":
                case "SCNConstraint":
                case "SCNLevelOfDetail":
                    // The NSSecureCoding protocol was added to these types in Yosemite,
                    // and we can't (yet?) describe "type added protocol P in version X.Y"
                    // with our AvailabilityAttribute, so do this check manually.
                    if (selectorName == "encodeWithCoder:" && !Mac.CheckSystemVersion(10, 10))
                    {
                        return(true);
                    }
                    break;
                }

                switch (type.Name)
                {
                case "SCNGeometry":
                    // SCNGeometry added the SCNShadable protocol in 10.9, which brings in the 'program' selector.
                    switch (selectorName)
                    {
                    case "program":
                    case "setProgram:":
                        if (!Mac.CheckSystemVersion(10, 9))
                        {
                            return(true);
                        }
                        break;
                    }
                    break;
                }
                break;
            }
            return(base.Skip(type, selectorName));
        }
        protected override bool Skip(Type type)
        {
            switch (type.FullName)
            {
#if !XAMCORE_4_0
            case "AppKit.NSDraggingInfo":
            case "MonoMac.AppKit.NSDraggingInfo":             // binding mistakes.
                return(true);
#endif
            // Random failures on build machine
            case "QuickLookUI.QLPreviewPanel":
            case "MonoMac.QuickLookUI.QLPreviewPanel":
                return(true);

            // These should be DisableDefaultCtor but can't due to backward compat
            case "MonoMac.AppKit.NSCollectionViewTransitionLayout":
            case "AppKit.NSCollectionViewTransitionLayout":
            case "Foundation.NSUnitDispersion":                  // -init should never be called on NSUnit!
            case "Foundation.NSUnitVolume":                      // -init should never be called on NSUnit!
            case "Foundation.NSUnitDuration":                    // -init should never be called on NSUnit!
            case "Foundation.NSUnitElectricCharge":              // -init should never be called on NSUnit!
            case "Foundation.NSUnitElectricCurrent":             // -init should never be called on NSUnit!
            case "Foundation.NSUnitElectricPotentialDifference": // -init should never be called on NSUnit!
            case "Foundation.NSUnitElectricResistance":          // -init should never be called on NSUnit!
            case "Foundation.NSUnit":                            // -init should never be called on NSUnit!
            case "Foundation.NSUnitEnergy":                      // -init should never be called on NSUnit!
            case "Foundation.NSUnitAcceleration":                // -init should never be called on NSUnit!
            case "Foundation.NSUnitFrequency":                   // -init should never be called on NSUnit!
            case "Foundation.NSUnitAngle":                       // -init should never be called on NSUnit!
            case "Foundation.NSUnitFuelEfficiency":              // -init should never be called on NSUnit!
            case "Foundation.NSUnitArea":                        // -init should never be called on NSUnit!
            case "Foundation.NSUnitIlluminance":                 // -init should never be called on NSUnit!
            case "Foundation.NSUnitConcentrationMass":           // -init should never be called on NSUnit!
            case "Foundation.NSUnitLength":                      // -init should never be called on NSUnit!
            case "Foundation.NSUnitMass":                        // -init should never be called on NSUnit!
            case "Foundation.NSUnitPower":                       // -init should never be called on NSUnit!
            case "Foundation.NSUnitPressure":                    // -init should never be called on NSUnit!
            case "Foundation.NSUnitSpeed":                       // -init should never be called on NSUnit!
            case "MonoMac.EventKit.EKParticipant":
            case "EventKit.EKParticipant":
            case "XamCore.CoreImage.CISampler":
            case "CoreImage.CISampler":
                return(true);

            // OSX 10.8+
            case "MonoMac.AppKit.NSSharingService":
            case "AppKit.NSSharingService":
            case "MonoMac.AppKit.NSSharingServicePicker":
            case "AppKit.NSSharingServicePicker":
            case "MonoMac.Foundation.NSUserNotification":
            case "Foundation.NSUserNotification":
            case "MonoMac.Foundation.NSUserNotificationCenter":
            case "Foundation.NSUserNotificationCenter":
            case "MonoMac.AVFoundation.AVPlayerItemVideoOutput":
            case "AVFoundation.AVPlayerItemVideoOutput":
            case "MonoMac.Foundation.NSUuid":
            case "Foundation.NSUuid":
                if (!Mac.CheckSystemVersion(10, 8))
                {
                    return(true);
                }
                break;

            // Native exception coming from [NSWindow init] which calls
            // [NSWindow initWithContentRect:styleMask:backing:defer]
            case "MonoMac.AppKit.NSWindow":
            case "AppKit.NSWindow":
                return(true);

            case "MonoMac.Foundation.NSUrlSession":
            case "Foundation.NSUrlSession":
            case "MonoMac.Foundation.NSUrlSessionTask":
            case "Foundation.NSUrlSessionTask":
            case "MonoMac.Foundation.NSUrlSessionDataTask":
            case "Foundation.NSUrlSessionDataTask":
            case "MonoMac.Foundation.NSUrlSessionUploadTask":
            case "Foundation.NSUrlSessionUploadTask":
            case "MonoMac.Foundation.NSUrlSessionDownloadTask":
            case "Foundation.NSUrlSessionDownloadTask":
            case "MonoMac.Foundation.NSUrlSessionConfiguration":
            case "Foundation.NSUrlSessionConfiguration":
                // These types were introduced as 64-bit only in Mavericks, and 32+64bits in Yosemite. We can't
                // express that with our AvailabilityAttribute, we set it as available (for all architectures, since
                // we can't distinguish them) starting with Mavericks.
                if (Mac.Is32BitMavericks)
                {
                    return(true);
                }
                break;

            case "GLKit.GLKSkyboxEffect":
                // Crashes inside libGL.dylib, most likely because something hasn't been initialized yet, because
                // I can reproduce in an Xcode project if I put [[GLKSkyboxEffect alloc] init]; in main, but it doesn't
                // crash in applicationDidFinishLaunching.
                //
                //  frame #0: 0x00007fff8d570db1 libGL.dylib`glGetError + 13
                //  frame #1: 0x0000000100025542 GLKit`-[GLKEffect initWithPropertyArray:] + 1142
                //  frame #2: 0x0000000100022c2d GLKit`-[GLKSkyboxEffect init] + 493
                //
                if (IntPtr.Size == 8)
                {
                    return(true);
                }
                break;

#if !XAMCORE_3_0
            case "SpriteKit.SKView":
                // Causes a crash later. Filed as radar://18440271.
                // Apple said they won't fix this ('init' isn't a designated initializer)
                if (IntPtr.Size == 8)
                {
                    return(true);
                }
                break;
#endif

            case "MonoMac.AppKit.NSSpeechRecognizer":
            case "AppKit.NSSpeechRecognizer":
                // Makes OSX put up "a download is required for speech recognition" dialog.
                return(true);

            case "MonoMac.Foundation.NSUserActivity":
            case "Foundation.NSUserActivity":
                // Crashes by default:
                // Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Caller did not provide an activityType, and this process does not have a NSUserActivityTypes in its Info.plist.
                // but since it looks like the constructor is usable with the proper Info.plist, we can't remove it.
                return(true);

            case "MonoMac.AppKit.NSTextTableBlock":
            case "AppKit.NSTextTableBlock":
            case "MonoMac.AppKit.NSMutableFontCollection":
            case "AppKit.NSMutableFontCollection":
                return(true);                // Crashes in 10.12

            case "CoreBluetooth.CBCentralManager":
            case "MonoMac.CoreBluetooth.CBCentralManager":
                if (IntPtr.Size == 4 && Mac.CheckSystemVersion(10, 13))                  // 32-bit removed unannounced in 10.13
                {
                    return(true);
                }
                break;

            case "EventKit.EKEventStore":
            case "MonoMac.EventKit.EKEventStore":
                if (Mac.CheckSystemVersion(10, 9) && !Mac.CheckSystemVersion(10, 10))
                {
                    // Calling the constructor on Mavericks will put up a permission dialog.
                    return(true);
                }
                break;

            case "MonoMac.ImageKit.IKPictureTaker":
            case "ImageKit.IKPictureTaker":
                // https://bugzilla.xamarin.com/show_bug.cgi?id=46624
                // https://trello.com/c/T6vkA2QF/62-29311598-ikpicturetaker-crashes-randomly-upon-deallocation?menu=filter&filter=corenfc
                return(true);

            case "Photos.PHProjectChangeRequest":
                if (TestRuntime.CheckSystemVersion(ObjCRuntime.PlatformName.MacOSX, 10, 15))
                {
                    /*
                     * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This method can only be called from inside of -[PHPhotoLibrary performChanges:completionHandler:] or -[PHPhotoLibrary performChangesAndWait:error:]'
                     * 0   CoreFoundation                      0x00007fff34f29063 __exceptionPreprocess + 250
                     * 1   libobjc.A.dylib                     0x00007fff6a6aa06b objc_exception_throw + 48
                     * 2   Photos                              0x00007fff3fe8a643 +[PHPhotoLibrary stringFromPHPhotoLibraryType:] + 0
                     * 3   Photos                              0x00007fff3ff6055d -[PHChangeRequest init] + 85
                     */
                    return(true);
                }
                break;

            case "AVKit.AVCaptureView":
                // Deallocating the AVCaptureView starts up the A/V capturing pipeline (!):

                /*
                 * 24  com.apple.avfoundation            0x00007fff28298a2f -[AVCaptureSession startRunning] + 97
                 * 25  com.apple.AVKit                   0x00007fff2866621f __72-[AVCaptureController _createDefaultSessionAndFileOutputAsynchronously:]_block_invoke_2 + 293
                 * 26  com.apple.AVKit                   0x00007fff2866609a __72-[AVCaptureController _createDefaultSessionAndFileOutputAsynchronously:]_block_invoke + 489
                 * 27  com.apple.AVKit                   0x00007fff28661bd4 -[AVCaptureController _createDefaultSessionAndFileOutputAsynchronously:] + 234
                 * 28  com.apple.AVKit                   0x00007fff28661c53 -[AVCaptureController session] + 53
                 * 29  com.apple.AVKit                   0x00007fff28670d2b -[AVCaptureView dealloc] + 124
                 *
                 *      This is unfortunate because capturing audio/video requires permission,
                 *      and since macOS tests don't execute in a session that can show UI,
                 *      the permission system (TCC) fails and the process ends up crashing
                 *      due to a privacy violation (even if the required entry is present in the Info.plist).
                 */
                return(true);

            case "AVFoundation.AVAudioRecorder":             // Stopped working in macOS 10.15.2
                return(TestRuntime.CheckXcodeVersion(11, 2));
            }

            switch (type.Namespace)
            {
            // OSX 10.8+
            case "MonoMac.Accounts":
            case "Accounts":
            case "MonoMac.GameKit":
            case "GameKit":
            case "MonoMac.Social":
            case "Social":
            case "MonoMac.StoreKit":
            case "StoreKit":
                if (!Mac.CheckSystemVersion(10, 8))
                {
                    return(true);
                }
                break;

            case "SceneKit":
            case "MonoMac.SceneKit":
                if (!Mac.CheckSystemVersion(10, 8) || IntPtr.Size != 8)
                {
                    return(true);
                }
                break;

            case "MediaPlayer":
            case "MonoMac.MediaPlayer":
                if (!Mac.CheckSystemVersion(10, 12) || IntPtr.Size != 8)
                {
                    return(true);
                }
                break;

            case "QTKit":
                if (Mac.CheckSystemVersion(10, 15))                  // QTKit is gone in 10.15
                {
                    return(true);
                }
                break;
            }

            return(base.Skip(type));
        }
        protected override bool Skip(Type type, MethodBase method, string selector)
        {
            switch (type.Namespace)
            {
            case "MonoMac.GameKit":
            case "GameKit":
            case "MonoMac.StoreKit":
            case "StoreKit":
                if (!Mac.CheckSystemVersion(10, 8))
                {
                    return(true);
                }
                break;

            case "MonoMac.SceneKit":
            case "SceneKit":
                // SceneKit is half-baked at best, and they broke compatibility significantly
                // from Mountain Lion to Mavericks, so just ignore all problems there.
                if (!Mac.CheckSystemVersion(10, 9))
                {
                    return(true);
                }
                break;
            }

            // Bug 20232 - This is a hack.
            if (selector == "geometryElementWithData:primitiveType:primitiveCount:bytesPerIndex:")
            {
                return(true);
            }

            switch (type.Name)
            {
            case "AVPlayerItemOutput":
            case "AVPlayerItemVideoOutput":
            case "NSSharingService":
            case "NSSharingServicePicker":
            case "NSUserNotification":
            case "NSUserNotificationCenter":
            case "NSUuid":
                return(!Mac.CheckSystemVersion(10, 8));

            case "CALayer":
            case "CAEmitterLayer":
            case "CAGradientLayer":
            case "CAOpenGLLayer":
            case "CAReplicatorLayer":
            case "CAScrollLayer":
            case "CAShapeLayer":
            case "CATextLayer":
            case "CATiledLayer":
            case "CATransformLayer":
            case "QTCaptureLayer":
            case "QTMovieLayer":
            case "QCCompositionLayer":
            case "AVCaptureVideoPreviewLayer":
            case "AVPlayerLayer":
            case "SCNLayer":
                switch (selector)
                {
                // CAGradientLayer 'instance MonoMac.CoreAnimation.CAConstraint[] get_Constraints()' selector: constraints == @?@:
                case "constraints":
                // CAGradientLayer 'instance Void set_Constraints(MonoMac.CoreAnimation.CAConstraint[])' selector: setConstraints: == v@:@?
                case "setConstraints:":
                    return(true);
                }
                break;

            case "SCNSkinner":
                return(!Mac.CheckSystemVersion(10, 9));

            case "NSGradient":
                switch (selector)
                {
                case "initWithColorsAndLocations:":                 // variable length parameters ...
                case "initWithColors:atLocations:colorSpace:":      // void * -> nfloat [] (internal)
                    return(true);
                }
                break;

            case "AVAudioIONode":
            case "AVAudioUnit":
                switch (selector)
                {
                case "audioUnit":                 // ^{ComponentInstanceRecord=[1l], tested to work in an apitest
                    return(true);
                }
                break;
            }
            return(base.Skip(type, method, selector));
        }
Esempio n. 20
0
        protected override bool Skip(Type type)
        {
            switch (type.FullName)
            {
#if !XAMCORE_4_0
            case "AppKit.NSDraggingInfo":
            case "MonoMac.AppKit.NSDraggingInfo":             // binding mistakes.
                return(true);
#endif
            // Random failures on build machine
            case "QuickLookUI.QLPreviewPanel":
            case "MonoMac.QuickLookUI.QLPreviewPanel":
                return(true);

            // These should be DisableDefaultCtor but can't due to backward compat
            case "MonoMac.AppKit.NSCollectionViewTransitionLayout":
            case "AppKit.NSCollectionViewTransitionLayout":
            case "Foundation.NSUnitDispersion":                  // -init should never be called on NSUnit!
            case "Foundation.NSUnitVolume":                      // -init should never be called on NSUnit!
            case "Foundation.NSUnitDuration":                    // -init should never be called on NSUnit!
            case "Foundation.NSUnitElectricCharge":              // -init should never be called on NSUnit!
            case "Foundation.NSUnitElectricCurrent":             // -init should never be called on NSUnit!
            case "Foundation.NSUnitElectricPotentialDifference": // -init should never be called on NSUnit!
            case "Foundation.NSUnitElectricResistance":          // -init should never be called on NSUnit!
            case "Foundation.NSUnit":                            // -init should never be called on NSUnit!
            case "Foundation.NSUnitEnergy":                      // -init should never be called on NSUnit!
            case "Foundation.NSUnitAcceleration":                // -init should never be called on NSUnit!
            case "Foundation.NSUnitFrequency":                   // -init should never be called on NSUnit!
            case "Foundation.NSUnitAngle":                       // -init should never be called on NSUnit!
            case "Foundation.NSUnitFuelEfficiency":              // -init should never be called on NSUnit!
            case "Foundation.NSUnitArea":                        // -init should never be called on NSUnit!
            case "Foundation.NSUnitIlluminance":                 // -init should never be called on NSUnit!
            case "Foundation.NSUnitConcentrationMass":           // -init should never be called on NSUnit!
            case "Foundation.NSUnitLength":                      // -init should never be called on NSUnit!
            case "Foundation.NSUnitMass":                        // -init should never be called on NSUnit!
            case "Foundation.NSUnitPower":                       // -init should never be called on NSUnit!
            case "Foundation.NSUnitPressure":                    // -init should never be called on NSUnit!
            case "Foundation.NSUnitSpeed":                       // -init should never be called on NSUnit!
            case "MonoMac.EventKit.EKParticipant":
            case "EventKit.EKParticipant":
            case "XamCore.CoreImage.CISampler":
            case "CoreImage.CISampler":
                return(true);

            // OSX 10.8+
            case "MonoMac.AppKit.NSSharingService":
            case "AppKit.NSSharingService":
            case "MonoMac.AppKit.NSSharingServicePicker":
            case "AppKit.NSSharingServicePicker":
            case "MonoMac.Foundation.NSUserNotification":
            case "Foundation.NSUserNotification":
            case "MonoMac.Foundation.NSUserNotificationCenter":
            case "Foundation.NSUserNotificationCenter":
            case "MonoMac.AVFoundation.AVPlayerItemVideoOutput":
            case "AVFoundation.AVPlayerItemVideoOutput":
            case "MonoMac.Foundation.NSUuid":
            case "Foundation.NSUuid":
                if (!Mac.CheckSystemVersion(10, 8))
                {
                    return(true);
                }
                break;

            // Native exception coming from [NSWindow init] which calls
            // [NSWindow initWithContentRect:styleMask:backing:defer]
            case "MonoMac.AppKit.NSWindow":
            case "AppKit.NSWindow":
                return(true);

#if !XAMCORE_2_0
            case "MonoMac.AppKit.NSToolbar":               // mono[10518:626783] *** -[__NSDictionaryM removeObjectForKey:]: key cannot be nil
            case "MonoMac.SceneKit.SCNRenderer":           // -[SCNRenderer init]: unrecognized selector sent to instance 0x7c6446c0
            case "MonoMac.SceneKit.SCNLookAtConstraint":
                return(true);
#endif
            case "MonoMac.Foundation.NSUrlSession":
            case "Foundation.NSUrlSession":
            case "MonoMac.Foundation.NSUrlSessionTask":
            case "Foundation.NSUrlSessionTask":
            case "MonoMac.Foundation.NSUrlSessionDataTask":
            case "Foundation.NSUrlSessionDataTask":
            case "MonoMac.Foundation.NSUrlSessionUploadTask":
            case "Foundation.NSUrlSessionUploadTask":
            case "MonoMac.Foundation.NSUrlSessionDownloadTask":
            case "Foundation.NSUrlSessionDownloadTask":
            case "MonoMac.Foundation.NSUrlSessionConfiguration":
            case "Foundation.NSUrlSessionConfiguration":
                // These types were introduced as 64-bit only in Mavericks, and 32+64bits in Yosemite. We can't
                // express that with our AvailabilityAttribute, we set it as available (for all architectures, since
                // we can't distinguish them) starting with Mavericks.
                if (Mac.Is32BitMavericks)
                {
                    return(true);
                }
                break;

            case "GLKit.GLKSkyboxEffect":
                // Crashes inside libGL.dylib, most likely because something hasn't been initialized yet, because
                // I can reproduce in an Xcode project if I put [[GLKSkyboxEffect alloc] init]; in main, but it doesn't
                // crash in applicationDidFinishLaunching.
                //
                //  frame #0: 0x00007fff8d570db1 libGL.dylib`glGetError + 13
                //  frame #1: 0x0000000100025542 GLKit`-[GLKEffect initWithPropertyArray:] + 1142
                //  frame #2: 0x0000000100022c2d GLKit`-[GLKSkyboxEffect init] + 493
                //
                if (IntPtr.Size == 8)
                {
                    return(true);
                }
                break;

#if !XAMCORE_3_0
            case "SpriteKit.SKView":
                // Causes a crash later. Filed as radar://18440271.
                // Apple said they won't fix this ('init' isn't a designated initializer)
                if (IntPtr.Size == 8)
                {
                    return(true);
                }
                break;
#endif

            case "MonoMac.AppKit.NSSpeechRecognizer":
            case "AppKit.NSSpeechRecognizer":
                // Makes OSX put up "a download is required for speech recognition" dialog.
                return(true);

            case "MonoMac.Foundation.NSUserActivity":
            case "Foundation.NSUserActivity":
                // Crashes by default:
                // Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Caller did not provide an activityType, and this process does not have a NSUserActivityTypes in its Info.plist.
                // but since it looks like the constructor is usable with the proper Info.plist, we can't remove it.
                return(true);

            case "MonoMac.AppKit.NSTextTableBlock":
            case "AppKit.NSTextTableBlock":
            case "MonoMac.AppKit.NSMutableFontCollection":
            case "AppKit.NSMutableFontCollection":
                return(true);                // Crashes in 10.12

            case "CoreBluetooth.CBCentralManager":
            case "MonoMac.CoreBluetooth.CBCentralManager":
                if (IntPtr.Size == 4 && Mac.CheckSystemVersion(10, 13))                  // 32-bit removed unannounced in 10.13
                {
                    return(true);
                }
                break;
            }

            switch (type.Namespace)
            {
            // OSX 10.8+
            case "MonoMac.Accounts":
            case "Accounts":
            case "MonoMac.GameKit":
            case "GameKit":
            case "MonoMac.Social":
            case "Social":
            case "MonoMac.StoreKit":
            case "StoreKit":
                if (!Mac.CheckSystemVersion(10, 8))
                {
                    return(true);
                }
                break;

            case "SceneKit":
            case "MonoMac.SceneKit":
                if (!Mac.CheckSystemVersion(10, 8) || IntPtr.Size != 8)
                {
                    return(true);
                }
                break;

            case "MediaPlayer":
            case "MonoMac.MediaPlayer":
                if (!Mac.CheckSystemVersion(10, 12) || IntPtr.Size != 8)
                {
                    return(true);
                }
                break;

            case "MonoMac.ImageKit.IKPictureTaker":
            case "ImageKit.IKPictureTaker":
                // https://bugzilla.xamarin.com/show_bug.cgi?id=46624
                // https://trello.com/c/T6vkA2QF/62-29311598-ikpicturetaker-crashes-randomly-upon-deallocation?menu=filter&filter=corenfc
                return(true);
            }

            return(base.Skip(type));
        }