diff --git a/src/CloudKit/CKCompat.cs b/src/CloudKit/CKCompat.cs index c3fb92a09a88..efb6bdcef65a 100644 --- a/src/CloudKit/CKCompat.cs +++ b/src/CloudKit/CKCompat.cs @@ -162,15 +162,6 @@ public virtual string? LastName { #endif #if WATCH - - public partial class CKModifyBadgeOperation { - - // `init` does not work on watchOS but we can keep compatibility with a different init - public CKModifyBadgeOperation () : this (0) - { - } - } - public partial class CKModifyRecordZonesOperation { // `init` does not work on watchOS but we can keep compatibility with a different init diff --git a/src/CloudKit/CKFetchNotificationChangesOperation.cs b/src/CloudKit/CKFetchNotificationChangesOperation.cs new file mode 100644 index 000000000000..16c1dfc567aa --- /dev/null +++ b/src/CloudKit/CKFetchNotificationChangesOperation.cs @@ -0,0 +1,97 @@ +#if !XAMCORE_5_0 + +using System; +using System.ComponentModel; +using System.Runtime.Versioning; +using System.Diagnostics.CodeAnalysis; + +using Foundation; +using ObjCRuntime; + +#nullable enable + +#if !NET +using NativeHandle = System.IntPtr; +#endif + +namespace CloudKit { + [Register ("CKFetchNotificationChangesOperation", SkipRegistration = true)] +#if NET + [UnsupportedOSPlatform ("ios", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] + [UnsupportedOSPlatform ("macos", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] + [UnsupportedOSPlatform ("tvos", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] + [UnsupportedOSPlatform ("maccatalyst", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] +#else + [Obsolete ("Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] +#endif + [EditorBrowsable (EditorBrowsableState.Never)] + public unsafe partial class CKFetchNotificationChangesOperation : CKOperation { + public override NativeHandle ClassHandle { get => throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); } + + protected CKFetchNotificationChangesOperation (NSObjectFlag t) : base (t) + { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + + protected internal CKFetchNotificationChangesOperation (NativeHandle handle) : base (handle) + { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + + public CKFetchNotificationChangesOperation () + : base (NSObjectFlag.Empty) + { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + + public CKFetchNotificationChangesOperation (CKServerChangeToken? previousServerChangeToken) + : base (NSObjectFlag.Empty) + { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + + public unsafe virtual global::System.Action? Completed { + get { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + set { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + } + + public virtual bool MoreComing { + get { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + } + + public unsafe virtual global::System.Action? NotificationChanged { + get { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + set { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + } + + public virtual CKServerChangeToken? PreviousServerChangeToken { + get { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + set { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + } + + public virtual nuint ResultsLimit { + get { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + set { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + } + } /* class CKFetchNotificationChangesOperation */ +} + +#endif // !XAMCORE_5_0 diff --git a/src/CloudKit/CKMarkNotificationsReadOperation.cs b/src/CloudKit/CKMarkNotificationsReadOperation.cs new file mode 100644 index 000000000000..440416a5df09 --- /dev/null +++ b/src/CloudKit/CKMarkNotificationsReadOperation.cs @@ -0,0 +1,67 @@ +#if !XAMCORE_5_0 + +using System; +using System.ComponentModel; +using System.Runtime.Versioning; +using System.Diagnostics.CodeAnalysis; + +using Foundation; +using ObjCRuntime; + +#nullable enable + +#if !NET +using NativeHandle = System.IntPtr; +#endif + +namespace CloudKit { + [Register ("CKMarkNotificationsReadOperation", SkipRegistration = true)] +#if NET + [UnsupportedOSPlatform ("ios", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] + [UnsupportedOSPlatform ("macos", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] + [UnsupportedOSPlatform ("tvos", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] + [UnsupportedOSPlatform ("maccatalyst", "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] +#endif + [EditorBrowsable (EditorBrowsableState.Never)] + public unsafe partial class CKMarkNotificationsReadOperation : CKOperation { + public override NativeHandle ClassHandle { get => throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); } + + protected CKMarkNotificationsReadOperation (NSObjectFlag t) : base (t) + { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + + protected internal CKMarkNotificationsReadOperation (NativeHandle handle) : base (handle) + { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + + public CKMarkNotificationsReadOperation (CKNotificationID [] notificationIds) + : base (NSObjectFlag.Empty) + { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + + public unsafe virtual CKMarkNotificationsReadHandler? Completed { + get { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + set { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + } + + public virtual CKNotificationID []? NotificationIds { + get { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + set { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + } + } /* class CKMarkNotificationsReadOperation */ + + [EditorBrowsable (EditorBrowsableState.Never)] + public delegate void CKMarkNotificationsReadHandler (CKNotificationID [] notificationIDsMarkedRead, NSError operationError); +} +#endif // !XAMCORE_5_0 diff --git a/src/CloudKit/CKModifyBadgeOperation.cs b/src/CloudKit/CKModifyBadgeOperation.cs new file mode 100644 index 000000000000..c20549aa732c --- /dev/null +++ b/src/CloudKit/CKModifyBadgeOperation.cs @@ -0,0 +1,74 @@ +#if !XAMCORE_5_0 + +using System; +using System.ComponentModel; +using System.Runtime.Versioning; +using System.Diagnostics.CodeAnalysis; + +using Foundation; +using ObjCRuntime; + +#nullable enable + +#if !NET +using NativeHandle = System.IntPtr; +#endif + +namespace CloudKit { + [Register ("CKModifyBadgeOperation", SkipRegistration = true)] +#if NET + [UnsupportedOSPlatform ("ios", "Modifying badge counts is no longer supported.")] + [UnsupportedOSPlatform ("macos", "Modifying badge counts is no longer supported.")] + [UnsupportedOSPlatform ("tvos", "Modifying badge counts is no longer supported.")] + [UnsupportedOSPlatform ("maccatalyst", "Modifying badge counts is no longer supported.")] +#else + [Deprecated (PlatformName.MacOSX, 15, 0, message: "Modifying badge counts is no longer supported.")] + [Deprecated (PlatformName.iOS, 18, 0, message: "Modifying badge counts is no longer supported.")] + [Deprecated (PlatformName.WatchOS, 11, 0, message: "Modifying badge counts is no longer supported.")] + [Deprecated (PlatformName.TvOS, 18, 0, message: "Modifying badge counts is no longer supported.")] +#endif + [EditorBrowsable (EditorBrowsableState.Never)] + public class CKModifyBadgeOperation : CKOperation { + public override NativeHandle ClassHandle { get => throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); } + + public CKModifyBadgeOperation () : base (NSObjectFlag.Empty) + { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + + protected CKModifyBadgeOperation (NSObjectFlag t) : base (t) + { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + + protected internal CKModifyBadgeOperation (NativeHandle handle) : base (handle) + { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + + public CKModifyBadgeOperation (nuint badgeValue) + : base (NSObjectFlag.Empty) + { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + + public virtual nuint BadgeValue { + get { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + set { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + } + + public unsafe virtual global::System.Action? Completed { + get { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + set { + throw new PlatformNotSupportedException (Constants.TypeRemovedAllPlatforms); + } + } + } /* class CKModifyBadgeOperation */ +} +#endif // !XAMCORE_5_0 diff --git a/src/cloudkit.cs b/src/cloudkit.cs index bc21df90ac7a..ca88782131d0 100644 --- a/src/cloudkit.cs +++ b/src/cloudkit.cs @@ -79,6 +79,11 @@ interface CKUserIdentity : NSSecureCoding, NSCopying { [NoTV] [MacCatalyst (13, 1)] + [Deprecated (PlatformName.WatchOS, 11, 0, message: "Please read Apple's document about 'Sharing CloudKit Data with Other iCloud Users'.")] + [Deprecated (PlatformName.TvOS, 18, 0, message: "Please read Apple's document about 'Sharing CloudKit Data with Other iCloud Users'.")] + [Deprecated (PlatformName.iOS, 18, 0, message: "Please read Apple's document about 'Sharing CloudKit Data with Other iCloud Users'.")] + [Deprecated (PlatformName.MacCatalyst, 18, 0, message: "Please read Apple's document about 'Sharing CloudKit Data with Other iCloud Users'.")] + [Deprecated (PlatformName.MacOSX, 15, 0, message: "Please read Apple's document about 'Sharing CloudKit Data with Other iCloud Users'.")] [Export ("contactIdentifiers", ArgumentSemantic.Copy)] string [] ContactIdentifiers { get; } } @@ -217,6 +222,10 @@ interface CKShareParticipant : NSSecureCoding, NSCopying { [Export ("permission", ArgumentSemantic.Assign)] CKShareParticipantPermission Permission { get; set; } + + // This showed up in Xcode 16's b1 headers, but according to the availability attributes it's always been available. + [Export ("participantID", ArgumentSemantic.Copy)] + string ParticipantId { get; } } [MacCatalyst (13, 1)] @@ -525,48 +534,6 @@ interface CKErrorFields { NSString UserDidResetEncryptedDataKey { get; } } - [BaseType (typeof (CKOperation))] - [Deprecated (PlatformName.iOS, 11, 0, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] - [Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] - [Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] - [Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] - [MacCatalyst (13, 1)] - [Deprecated (PlatformName.MacCatalyst, 13, 1, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] - [DisableDefaultCtor] // designated - interface CKFetchNotificationChangesOperation { - - [DesignatedInitializer] - [Export ("init")] - NativeHandle Constructor (); - - [Export ("initWithPreviousServerChangeToken:")] - NativeHandle Constructor ([NullAllowed] CKServerChangeToken previousServerChangeToken); - - [NullAllowed] // by default this property is null - [Export ("previousServerChangeToken", ArgumentSemantic.Copy)] - CKServerChangeToken PreviousServerChangeToken { get; set; } - - [Export ("resultsLimit")] - nuint ResultsLimit { get; set; } - - [Export ("moreComing")] - bool MoreComing { get; } - - [NullAllowed] // by default this property is null - [Export ("notificationChangedBlock", ArgumentSemantic.Copy)] - Action NotificationChanged { - get; - set; - } - - [NullAllowed] // by default this property is null - [Export ("fetchNotificationChangesCompletionBlock", ArgumentSemantic.Copy)] - Action Completed { - get; - set; - } - } - [MacCatalyst (13, 1)] [DisableDefaultCtor] // Objective-C exception thrown. Name: CKException Reason: You can't call init on CKServerChangeToken [BaseType (typeof (NSObject))] @@ -890,63 +857,6 @@ interface CKLocationSortDescriptor : NSSecureCoding { CLLocation RelativeLocation { get; } } - [MacCatalyst (13, 1)] - delegate void CKMarkNotificationsReadHandler (CKNotificationID [] notificationIDsMarkedRead, NSError operationError); - - [BaseType (typeof (CKOperation))] - [DisableDefaultCtor] // NSInvalidArgumentException Reason: You must call -[CKMarkNotificationsReadOperation initWithNotificationIDsToMarkRead:] - [Deprecated (PlatformName.iOS, 11, 0, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] - [Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] - [Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] - [Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] - [MacCatalyst (13, 1)] - [Deprecated (PlatformName.MacCatalyst, 13, 1, message: "Use 'CKDatabaseSubscription', 'CKFetchDatabaseChangesOperation' and 'CKFetchRecordZoneChangesOperation' instead.")] - interface CKMarkNotificationsReadOperation { - - [DesignatedInitializer] - [Export ("initWithNotificationIDsToMarkRead:")] - NativeHandle Constructor (CKNotificationID [] notificationIds); - - [NullAllowed] - [Export ("notificationIDs", ArgumentSemantic.Copy)] - CKNotificationID [] NotificationIds { get; set; } - - [NullAllowed] - [Export ("markNotificationsReadCompletionBlock", ArgumentSemantic.Copy)] - CKMarkNotificationsReadHandler Completed { - get; - set; - } - } - -#if WATCH - [DisableDefaultCtor] // does not work on watchOS, working stub provided to ease source compatibility -#else - [DesignatedDefaultCtor] -#endif - [BaseType (typeof (CKOperation))] - [Deprecated (PlatformName.iOS, 11, 0)] - [Deprecated (PlatformName.MacOSX, 10, 13)] - [Deprecated (PlatformName.WatchOS, 4, 0)] - [Deprecated (PlatformName.TvOS, 11, 0)] - [MacCatalyst (13, 1)] - [Deprecated (PlatformName.MacCatalyst, 13, 1)] - interface CKModifyBadgeOperation { - - [Export ("initWithBadgeValue:")] - NativeHandle Constructor (nuint badgeValue); - - [Export ("badgeValue", ArgumentSemantic.UnsafeUnretained)] - nuint BadgeValue { get; set; } - - [NullAllowed] // by default this property is null - [Export ("modifyBadgeCompletionBlock", ArgumentSemantic.Copy)] - Action Completed { - get; - set; - } - } - [MacCatalyst (13, 1)] delegate void CKModifyRecordsOperationHandler (CKRecord [] savedRecords, CKRecordID [] deletedRecordIds, NSError operationError); diff --git a/src/frameworks.sources b/src/frameworks.sources index 4d4a442db986..63459883ebaa 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -368,6 +368,9 @@ CLOUDKIT_API_SOURCES = \ CLOUDKIT_SOURCES = \ CloudKit/CKCompat.cs \ + CloudKit/CKFetchNotificationChangesOperation.cs \ + CloudKit/CKMarkNotificationsReadOperation.cs \ + CloudKit/CKModifyBadgeOperation.cs \ CloudKit/CKRecord.cs \ CloudKit/CKRecordID.cs \ CloudKit/CKRecordZoneID.cs \ diff --git a/tests/cecil-tests/AttributeTest.cs b/tests/cecil-tests/AttributeTest.cs index b9ccaa05017a..ba399a76c344 100644 --- a/tests/cecil-tests/AttributeTest.cs +++ b/tests/cecil-tests/AttributeTest.cs @@ -448,6 +448,9 @@ IEnumerable GetAllTypeMembers (TypeDefinition type) // public static void Extension () { } // } // + // Special case: it's allowed to not have an introduced if the only other attribute is an + // UnsupportedOSPlatform with no version. + // // When run against mac, this fails as Extension does not include a mac supported of any kind attribute [TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblyDefinitions))] public void AllAttributedItemsMustIncludeCurrentPlatform (AssemblyInfo info) @@ -474,7 +477,7 @@ public void AllAttributedItemsMustIncludeCurrentPlatform (AssemblyInfo info) void CheckCurrentPlatformIncludedIfAny (ICustomAttributeProvider item, string platformName, string fullName, TypeDefinition parent, HashSet found) { - if (HasAnyAvailabilityAttribute (item)) { + if (HasAnyAvailabilityAttribute (item, onlyUnsupportedWithVersion: true)) { if (IgnoreCurrentPlatform (fullName)) { return; } @@ -572,12 +575,36 @@ IEnumerable GetAvailabilityAttributesCore (IEnumerable return null; } - bool HasAnyAvailabilityAttribute (ICustomAttributeProvider provider) => provider.CustomAttributes.Any (a => IsAvailabilityAttribute (a)); + bool HasAnyAvailabilityAttribute (ICustomAttributeProvider provider, bool onlyUnsupportedWithVersion = false) + { + return provider.CustomAttributes.Any (a => IsAvailabilityAttribute (a, onlyUnsupportedWithVersion)); + } + bool HasAnySupportedAttribute (ICustomAttributeProvider provider) => provider.CustomAttributes.Any (a => IsSupportedAttribute (a)); - bool IsAvailabilityAttribute (CustomAttribute attribute) => IsSupportedAttribute (attribute) || attribute.AttributeType.Name == "UnsupportedOSPlatformAttribute"; + bool IsAvailabilityAttribute (CustomAttribute attribute) => IsAvailabilityAttribute (attribute, false); + bool IsAvailabilityAttribute (CustomAttribute attribute, bool onlyUnsupportedWithVersion) + { + if (IsSupportedAttribute (attribute)) + return true; + + return IsUnsupportedAttribute (attribute, onlyUnsupportedWithVersion); + } + bool IsSupportedAttribute (CustomAttribute attribute) => attribute.AttributeType.Name == "SupportedOSPlatformAttribute"; + static char [] versionCharacters = new char [] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.' }; + bool IsUnsupportedAttribute (CustomAttribute attribute, bool onlyWithVersion = false) + { + if (attribute.AttributeType.Name != "UnsupportedOSPlatformAttribute") + return false; + if (onlyWithVersion) { + var hasVersion = ((string) attribute.ConstructorArguments [0].Value).IndexOfAny (versionCharacters) > -1; + return hasVersion; + } + return true; + } + [TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblyDefinitions))] public void ModelMustBeProtocol (AssemblyInfo info) { diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index ae76c820a965..2322e10eb41c 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -28317,12 +28317,19 @@ M:CloudKit.CKDatabaseSubscription.Copy(Foundation.NSZone) M:CloudKit.CKDatabaseSubscription.EncodeTo(Foundation.NSCoder) M:CloudKit.CKFetchNotificationChangesOperation.#ctor M:CloudKit.CKFetchNotificationChangesOperation.#ctor(CloudKit.CKServerChangeToken) +M:CloudKit.CKFetchNotificationChangesOperation.#ctor(Foundation.NSObjectFlag) +M:CloudKit.CKFetchNotificationChangesOperation.#ctor(ObjCRuntime.NativeHandle) M:CloudKit.CKFetchRecordZoneChangesConfiguration.Copy(Foundation.NSZone) M:CloudKit.CKFetchRecordZoneChangesConfiguration.EncodeTo(Foundation.NSCoder) M:CloudKit.CKFetchRecordZoneChangesOptions.Copy(Foundation.NSZone) M:CloudKit.CKFetchRecordZoneChangesOptions.EncodeTo(Foundation.NSCoder) M:CloudKit.CKLocationSortDescriptor.EncodeTo(Foundation.NSCoder) M:CloudKit.CKMarkNotificationsReadOperation.#ctor(CloudKit.CKNotificationID[]) +M:CloudKit.CKMarkNotificationsReadOperation.#ctor(Foundation.NSObjectFlag) +M:CloudKit.CKMarkNotificationsReadOperation.#ctor(ObjCRuntime.NativeHandle) +M:CloudKit.CKModifyBadgeOperation.#ctor +M:CloudKit.CKModifyBadgeOperation.#ctor(Foundation.NSObjectFlag) +M:CloudKit.CKModifyBadgeOperation.#ctor(ObjCRuntime.NativeHandle) M:CloudKit.CKModifyBadgeOperation.#ctor(System.UIntPtr) M:CloudKit.CKNotification.EncodeTo(Foundation.NSCoder) M:CloudKit.CKNotificationID.Copy(Foundation.NSZone) @@ -58621,14 +58628,17 @@ P:CloudKit.CKErrorFields.RecordChangedErrorAncestorRecordKey P:CloudKit.CKErrorFields.RecordChangedErrorClientRecordKey P:CloudKit.CKErrorFields.RecordChangedErrorServerRecordKey P:CloudKit.CKErrorFields.UserDidResetEncryptedDataKey +P:CloudKit.CKFetchNotificationChangesOperation.ClassHandle P:CloudKit.CKFetchNotificationChangesOperation.Completed P:CloudKit.CKFetchNotificationChangesOperation.MoreComing P:CloudKit.CKFetchNotificationChangesOperation.NotificationChanged P:CloudKit.CKFetchNotificationChangesOperation.PreviousServerChangeToken P:CloudKit.CKFetchNotificationChangesOperation.ResultsLimit +P:CloudKit.CKMarkNotificationsReadOperation.ClassHandle P:CloudKit.CKMarkNotificationsReadOperation.Completed P:CloudKit.CKMarkNotificationsReadOperation.NotificationIds P:CloudKit.CKModifyBadgeOperation.BadgeValue +P:CloudKit.CKModifyBadgeOperation.ClassHandle P:CloudKit.CKModifyBadgeOperation.Completed P:CloudKit.CKOperation.LongLived P:CloudKit.CKOperationConfiguration.LongLived @@ -78475,7 +78485,6 @@ T:CloudKit.CKAcceptPerShareCompletionHandler T:CloudKit.CKDatabaseDeleteSubscriptionHandler T:CloudKit.CKErrorFields T:CloudKit.CKFetchDatabaseChangesCompletionHandler -T:CloudKit.CKFetchNotificationChangesOperation T:CloudKit.CKFetchPerShareMetadataHandler T:CloudKit.CKFetchRecordChangesHandler T:CloudKit.CKFetchRecordsCompletedHandler @@ -78487,9 +78496,6 @@ T:CloudKit.CKFetchShareParticipantsOperationPerShareParticipantCompletionHandler T:CloudKit.CKFetchSubscriptionsCompleteHandler T:CloudKit.CKFetchSubscriptionsPerSubscriptionCompletionHandler T:CloudKit.CKFetchWebAuthTokenOperationHandler -T:CloudKit.CKMarkNotificationsReadHandler -T:CloudKit.CKMarkNotificationsReadOperation -T:CloudKit.CKModifyBadgeOperation T:CloudKit.CKModifyRecordsOperationHandler T:CloudKit.CKModifyRecordsOperationPerRecordDeleteHandler T:CloudKit.CKModifyRecordsOperationPerRecordSaveHandler diff --git a/tests/introspection/ApiBaseTest.cs b/tests/introspection/ApiBaseTest.cs index 8a2667384236..f39126432519 100644 --- a/tests/introspection/ApiBaseTest.cs +++ b/tests/introspection/ApiBaseTest.cs @@ -20,6 +20,7 @@ // using System; +using System.ComponentModel; using System.IO; using System.Reflection; using System.Runtime.InteropServices; @@ -143,6 +144,20 @@ protected virtual bool Skip (Attribute attribute) return false; } + protected bool SkipDueToInvisibleAndUnsupported (MemberInfo member) + { + if (member is null) + return false; + + if (SkipDueToInvisibleAndUnsupported (member.DeclaringType)) + return true; + + if (!MemberHasUnsupported (member)) + return false; + + return MemberHasEditorBrowsableNever (member); + } + protected virtual bool SkipDueToAttribute (MemberInfo member) { if (member is null) @@ -202,6 +217,21 @@ public bool MemberHasObsolete (MemberInfo member) #endif } + public bool MemberHasUnsupported (MemberInfo member) + { +#if NET + return member.GetCustomAttributes (false).Any (); +#else + return member.GetCustomAttribute () is not null; +#endif + } + + public bool MemberHasEditorBrowsableNever (MemberInfo member) + { + var attribute = member.GetCustomAttribute (false); + return attribute?.State == EditorBrowsableState.Never; + } + /// /// Gets the assembly on which the test fixture will reflect the NSObject-derived types. /// The default implementation returns the assembly where NSObject is defined, e.g. diff --git a/tests/introspection/ApiCtorInitTest.cs b/tests/introspection/ApiCtorInitTest.cs index 12f1d8684db0..a0049668c80d 100644 --- a/tests/introspection/ApiCtorInitTest.cs +++ b/tests/introspection/ApiCtorInitTest.cs @@ -118,6 +118,7 @@ protected virtual bool Skip (Type type) return true; case "MPSImageArithmetic": // Cannot directly initialize MPSImageArithmetic. Use one of the sub-classes of MPSImageArithmetic. return true; + case "CKModifyBadgeOperation": case "CKDiscoverUserInfosOperation": // deprecated, throws exception case "CKSubscription": case "MPSCnnConvolutionState": @@ -275,6 +276,10 @@ public void DefaultCtorAllowed () if (SkipDueToAttribute (ctor)) continue; + // Don't test methods that have [UnsupportedOSPlatform] + [EditorBrowsable (Never)] + if (SkipDueToInvisibleAndUnsupported (ctor)) + continue; + if ((ctor is null) || ctor.IsAbstract) { if (LogUntestedTypes) Console.WriteLine ("[WARNING] {0} was skipped because it had no default constructor", t); diff --git a/tests/monotouch-test/CloudKit/CKFetchNotificationChangesOperationTest.cs b/tests/monotouch-test/CloudKit/CKFetchNotificationChangesOperationTest.cs deleted file mode 100644 index 387ac3079a8d..000000000000 --- a/tests/monotouch-test/CloudKit/CKFetchNotificationChangesOperationTest.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using NUnit.Framework; -using Foundation; -using CloudKit; -using ObjCRuntime; -using Xamarin.Utils; - -namespace MonoTouchFixtures.CloudKit { - - [TestFixture] - [Preserve (AllMembers = true)] - public class CKFetchNotificationChangesOperationTest { - CKServerChangeToken token = null; - CKFetchNotificationChangesOperation op = null; - - [SetUp] - public void SetUp () - { - TestRuntime.AssertXcodeVersion (6, 0); - TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false); - op = new CKFetchNotificationChangesOperation (token); - } - - [TearDown] - public void TearDown () - { - op?.Dispose (); - } - - [Test] - public void TestNotificationChangedSetter () - { - op.NotificationChanged = (obj) => { Console.WriteLine ("Notification"); }; - Assert.NotNull (op.NotificationChanged); - } - - [Test] - public void TestCompletedSetter () - { - op.Completed = (arg1, arg2) => { Console.WriteLine ("Completed"); }; - Assert.NotNull (op.Completed); - } - - [Test] - public void Default () - { - // watchOS does not allow `init` so we need to ensure that our default .ctor - // match the existing `init*` with null values (so we can remove it) - using (var mrzo = new CKFetchNotificationChangesOperation ()) { - Assert.That (op.PreviousServerChangeToken, Is.EqualTo (mrzo.PreviousServerChangeToken), "PreviousServerChangeToken"); - Assert.That (op.Completed, Is.EqualTo (mrzo.Completed), "Completed"); - Assert.That (op.NotificationChanged, Is.EqualTo (mrzo.NotificationChanged), "NotificationChanged"); - } - } - } -} diff --git a/tests/monotouch-test/CloudKit/CKMarkNotificationsReadOperationTest.cs b/tests/monotouch-test/CloudKit/CKMarkNotificationsReadOperationTest.cs deleted file mode 100644 index 8b988b89ec14..000000000000 --- a/tests/monotouch-test/CloudKit/CKMarkNotificationsReadOperationTest.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using NUnit.Framework; -using Foundation; -using CloudKit; -using ObjCRuntime; -using Xamarin.Utils; - -namespace MonoTouchFixtures.CloudKit { - - [TestFixture] - [Preserve (AllMembers = true)] - public class CKMarkNotificationsReadOperationTest { - CKNotificationID [] notificationIDs = new CKNotificationID [0]; - CKMarkNotificationsReadOperation op = null; - - [SetUp] - public void SetUp () - { - TestRuntime.AssertXcodeVersion (6, 0); - TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false); - op = new CKMarkNotificationsReadOperation (notificationIDs); - } - - [TearDown] - public void TearDown () - { - op?.Dispose (); - } - - [Test] - public void TestCompletedSetter () - { - op.Completed = (idDict, e) => { Console.WriteLine ("Completed"); }; - Assert.NotNull (op.Completed); - } - } -} diff --git a/tests/monotouch-test/CloudKit/CKModifyBadgeOperationTest.cs b/tests/monotouch-test/CloudKit/CKModifyBadgeOperationTest.cs deleted file mode 100644 index c30e69600e99..000000000000 --- a/tests/monotouch-test/CloudKit/CKModifyBadgeOperationTest.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using NUnit.Framework; -using Foundation; -using CloudKit; -using ObjCRuntime; -using Xamarin.Utils; - -namespace MonoTouchFixtures.CloudKit { - - [TestFixture] - [Preserve (AllMembers = true)] - public class CKModifyBadgeOperationTest { - CKModifyBadgeOperation op = null; - - [SetUp] - public void SetUp () - { - TestRuntime.AssertXcodeVersion (6, 0); - TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false); - op = new CKModifyBadgeOperation (3); - } - - [TearDown] - public void TearDown () - { - op?.Dispose (); - } - - [Test] - public void TestCompletedSetter () - { - op.Completed = (e) => { Console.WriteLine ("Completed"); }; - Assert.NotNull (op.Completed); - } - - [Test] - public void Default () - { - // watchOS does not allow `init` so we need to ensure that our default .ctor - // match the existing `init*` with null values (so we can remove it) - using (var def = new CKModifyBadgeOperation ()) - using (var zr0 = new CKModifyBadgeOperation (0)) { - Assert.That (def.BadgeValue, Is.EqualTo (zr0.BadgeValue), "BadgeValue"); - Assert.That (def.Completed, Is.EqualTo (zr0.Completed), "Completed"); - } - } - } -} diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-CloudKit.todo b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-CloudKit.todo deleted file mode 100644 index 26152e355d54..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-CloudKit.todo +++ /dev/null @@ -1,5 +0,0 @@ -!deprecated-attribute-missing! CKUserIdentity::contactIdentifiers missing a [Deprecated] attribute -!missing-selector! CKShareParticipant::participantID not bound -!unknown-type! CKFetchNotificationChangesOperation bound -!unknown-type! CKMarkNotificationsReadOperation bound -!unknown-type! CKModifyBadgeOperation bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-CloudKit.todo b/tests/xtro-sharpie/api-annotations-dotnet/iOS-CloudKit.todo deleted file mode 100644 index 26152e355d54..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-CloudKit.todo +++ /dev/null @@ -1,5 +0,0 @@ -!deprecated-attribute-missing! CKUserIdentity::contactIdentifiers missing a [Deprecated] attribute -!missing-selector! CKShareParticipant::participantID not bound -!unknown-type! CKFetchNotificationChangesOperation bound -!unknown-type! CKMarkNotificationsReadOperation bound -!unknown-type! CKModifyBadgeOperation bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-CloudKit.todo b/tests/xtro-sharpie/api-annotations-dotnet/macOS-CloudKit.todo deleted file mode 100644 index 26152e355d54..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-CloudKit.todo +++ /dev/null @@ -1,5 +0,0 @@ -!deprecated-attribute-missing! CKUserIdentity::contactIdentifiers missing a [Deprecated] attribute -!missing-selector! CKShareParticipant::participantID not bound -!unknown-type! CKFetchNotificationChangesOperation bound -!unknown-type! CKMarkNotificationsReadOperation bound -!unknown-type! CKModifyBadgeOperation bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-CloudKit.todo b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-CloudKit.todo deleted file mode 100644 index a4fc2c943a96..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-CloudKit.todo +++ /dev/null @@ -1,4 +0,0 @@ -!missing-selector! CKShareParticipant::participantID not bound -!unknown-type! CKFetchNotificationChangesOperation bound -!unknown-type! CKMarkNotificationsReadOperation bound -!unknown-type! CKModifyBadgeOperation bound diff --git a/tests/xtro-sharpie/iOS-CloudKit.todo b/tests/xtro-sharpie/iOS-CloudKit.todo deleted file mode 100644 index 26152e355d54..000000000000 --- a/tests/xtro-sharpie/iOS-CloudKit.todo +++ /dev/null @@ -1,5 +0,0 @@ -!deprecated-attribute-missing! CKUserIdentity::contactIdentifiers missing a [Deprecated] attribute -!missing-selector! CKShareParticipant::participantID not bound -!unknown-type! CKFetchNotificationChangesOperation bound -!unknown-type! CKMarkNotificationsReadOperation bound -!unknown-type! CKModifyBadgeOperation bound diff --git a/tests/xtro-sharpie/macOS-CloudKit.todo b/tests/xtro-sharpie/macOS-CloudKit.todo deleted file mode 100644 index 26152e355d54..000000000000 --- a/tests/xtro-sharpie/macOS-CloudKit.todo +++ /dev/null @@ -1,5 +0,0 @@ -!deprecated-attribute-missing! CKUserIdentity::contactIdentifiers missing a [Deprecated] attribute -!missing-selector! CKShareParticipant::participantID not bound -!unknown-type! CKFetchNotificationChangesOperation bound -!unknown-type! CKMarkNotificationsReadOperation bound -!unknown-type! CKModifyBadgeOperation bound diff --git a/tests/xtro-sharpie/tvOS-CloudKit.todo b/tests/xtro-sharpie/tvOS-CloudKit.todo deleted file mode 100644 index a4fc2c943a96..000000000000 --- a/tests/xtro-sharpie/tvOS-CloudKit.todo +++ /dev/null @@ -1,4 +0,0 @@ -!missing-selector! CKShareParticipant::participantID not bound -!unknown-type! CKFetchNotificationChangesOperation bound -!unknown-type! CKMarkNotificationsReadOperation bound -!unknown-type! CKModifyBadgeOperation bound diff --git a/tests/xtro-sharpie/watchOS-CloudKit.todo b/tests/xtro-sharpie/watchOS-CloudKit.todo deleted file mode 100644 index 26152e355d54..000000000000 --- a/tests/xtro-sharpie/watchOS-CloudKit.todo +++ /dev/null @@ -1,5 +0,0 @@ -!deprecated-attribute-missing! CKUserIdentity::contactIdentifiers missing a [Deprecated] attribute -!missing-selector! CKShareParticipant::participantID not bound -!unknown-type! CKFetchNotificationChangesOperation bound -!unknown-type! CKMarkNotificationsReadOperation bound -!unknown-type! CKModifyBadgeOperation bound