xamarin-macios/tests/introspection/ApiTypoTest.cs

1150 строки
26 KiB
C#
Исходник Обычный вид История

[MetalPerformanceShaders] Xcode 9 bindings (#3005) * [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816) * [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938) The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10 * Remove some [Model] attributes that sholdn't be needed * Fix introspection test crashes * More introspection fixes * NN does not need to be PascalCased Remove unneeded Models and BaseTypes * PR Whitespace fixes and renamings * Paste fail * More fixes from PR comments * [MPS] Adds new intro test, fixes ctors and xtro output * Removes duplicated availability attributes. * Removes obsoleted API from macOS since mps is new to it. * Fixes xtro output. * Adds missing API. * Fixes parameterless ctors, some of them do not really work, found by our new intro test and disabled the one that seem to not make sense due to the presence of DesignatedInitializers. * Fixes a selector typo. * Adds new `ShouldNotExposeDefaultCtorTest` to intro. ShouldNotExposeDefaultCtorTest ============================== This test checks for types with a parameterless ctor that are subclasses of `NSObject` and then cheks if the BaseType of said objects also expose a parameterless ctor (all in .NET land), if this is not the case it reports them and so they can manually audited. Also this test has the ability to print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can take this code into an Xcode project and easily tests the ctors. It seems that xtro (sharpie) does not have a complete picture of when a ctor must be exposed hence the hability to generate this code and manually test. Right now this test is just enabled for MPS since it is the scope of this PR. In the future it should be enabled for all other frameworks and the output be manually audited. * [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback. https://bugzilla.xamarin.com/show_bug.cgi?id=59547 * Fixes premature collection possible in bindings im MPSKernel.cs * Fixes MPSImageHistogramTest from using deprecated API. * Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest. * [MPS] Reenable Copy API and DesignatedInitializer xtro feedback * Implement more feedback * More feedback
2017-11-28 23:29:05 +03:00
//
// Test the generated API selectors against typos or non-existing cases
//
// Authors:
// Paola Villarreal <paola.villarreal@xamarin.com>
//
// Copyright 2015 Xamarin Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using NUnit.Framework;
using ObjCRuntime;
#if MONOMAC
using AppKit;
#else
using UIKit;
#endif
using Foundation;
using Xamarin.Tests;
using Xamarin.Utils;
namespace Introspection {
public abstract class ApiTypoTest : ApiBaseTest {
protected ApiTypoTest ()
{
ContinueOnFailure = true;
}
public virtual bool Skip (Type baseType, string typo)
{
return SkipAllowed (baseType.Name, null, typo);
}
public virtual bool Skip (MemberInfo methodName, string typo)
{
return SkipAllowed (methodName.DeclaringType.Name, methodName.Name, typo);
}
readonly HashSet<string> allowedRule3 = new HashSet<string> {
"IARAnchorCopying", // We're showing a code snippet in the 'Advice' message and that shouldn't end with a dot.
};
HashSet<string> allowedMemberRule4 = new HashSet<string> {
"Platform",
"PlatformHelper",
"AvailabilityAttribute",
"iOSAttribute",
"MacAttribute",
};
HashSet<string> allowed = new HashSet<string> () {
"Aac",
"Accurracy",
"Achivements",
"Acos",
2020-09-15 20:09:18 +03:00
"Acosh",
"Acn",
"Actionname",
"Activitiy",
"Addin",
"Addl",
"Addr",
"Adjustmentfor",
"Aes", // Advanced Encryption Standard
"Aifc",
"Aiff",
"Agc",
"Aio",
"Alg", // short for Algorithm
"Alpn", // Application-Layer Protocol Negotiation RFC7301
"Amete",
"Amr",
"Anglet",
"Apng", // Animated Portable Network Graphics
"Aps",
"Arraycollation",
2017-01-26 20:45:32 +03:00
"Argb",
"Asin",
2020-09-15 20:09:18 +03:00
"Asinh",
"Atan",
2020-09-15 20:09:18 +03:00
"Atanh",
"Atmos", // Dolby Atmos
"Ats", // App Transport Security
"Attrib",
"Attributevalue",
"Attrs", // Attributes (used by Apple for keys)
"Audiofile",
"Automapping",
"Automatch",
"Automounted",
"Autoredirect",
"Autospace",
"Autostarts",
"Avci", // file type
"Avb", // acronym: Audio Video Bridging
"Aliasable",
2017-08-15 15:29:33 +03:00
"Arcball",
"Atm",
"Avg",
"Backface",
2017-08-12 20:09:46 +03:00
"Bancaire", // french
"Bancaires", // french
"Bary",
"Batc",
"Bgra", // acrnym for Blue, Green, Red, Alpha
"Bim",
"Biquad",
"Bitangent",
"Blinn",
"Blit",
"Bokeh",
"Bggr", // acronym for Blue, Green, Green, Red
"Bsln",
"Bssid",
"Btle", // Bluetooth Low Energy
"Bzip",
"Cabac",
"Caf", // acronym: Core Audio Format
"Cancellable",
"Cartes", // french
"Cavlc",
"Cda", // acronym: Clinical Document Architecture
Fix a few introspection issues on Catalina. (#7212) (#7243) * [SceneKit] Adjust deprecation message. Fixes this introspection failure: [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Type: SCNLayer [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: get_OpenGLContext, Type: SCNView [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: set_OpenGLContext, Type: SCNView [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: get_PixelFormat, Type: SCNView [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: set_PixelFormat, Type: SCNView * [AppKit] Adjust deprecation messages. * [tests] Fix introspection and xammac tests on Catalina. (#7200) * [tests] Adjust NaturalLanguage.EmbeddingTest to cope with non-existent embeddings. Fixes xamarin/maccore#2011. Fixes https://github.com/xamarin/maccore/issues/2011. * [tests] Fix typo test on macOS 10.15. Fixes #7116. Fixes https://github.com/xamarin/xamarin-macios/issues/7116. * [introspection] Ignore MTLCounterSampleBufferDescriptor's selectors. They're implemented using a different/internal type: $ nm /System/Library/Frameworks/Metal.framework/Metal | grep MTLCounterSampleBuffer 00000000000458ab t +[MTLCounterSampleBufferDescriptor allocWithZone:] 0000000000045897 t +[MTLCounterSampleBufferDescriptor alloc] 000000000004591e t -[MTLCounterSampleBufferDescriptor copyWithZone:] 000000000004598e t -[MTLCounterSampleBufferDescriptorInternal copyWithZone:] 0000000000045c0f t -[MTLCounterSampleBufferDescriptorInternal counterSet] 0000000000045936 t -[MTLCounterSampleBufferDescriptorInternal dealloc] 0000000000045b65 t -[MTLCounterSampleBufferDescriptorInternal hash] 0000000000045a31 t -[MTLCounterSampleBufferDescriptorInternal isEqual:] 0000000000045c58 t -[MTLCounterSampleBufferDescriptorInternal label] 0000000000045c7f t -[MTLCounterSampleBufferDescriptorInternal sampleCount] 0000000000045c25 t -[MTLCounterSampleBufferDescriptorInternal setCounterSet:] 0000000000045c6e t -[MTLCounterSampleBufferDescriptorInternal setLabel:] 0000000000045c90 t -[MTLCounterSampleBufferDescriptorInternal setSampleCount:] 0000000000045c47 t -[MTLCounterSampleBufferDescriptorInternal setStorageMode:] 0000000000045c36 t -[MTLCounterSampleBufferDescriptorInternal storageMode] 000000000010b0b8 S _OBJC_CLASS_$_MTLCounterSampleBufferDescriptor 000000000010b0e0 S _OBJC_CLASS_$_MTLCounterSampleBufferDescriptorInternal 0000000000107070 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._counterSet 0000000000107078 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._label 0000000000107088 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._sampleCount 0000000000107080 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._storageMode 000000000010b108 S _OBJC_METACLASS_$_MTLCounterSampleBufferDescriptor 000000000010b130 S _OBJC_METACLASS_$_MTLCounterSampleBufferDescriptorInternal Fixes these test failures: 1) ApiSelectorTest.InstanceMethods (Introspection.MacApiSelectorTest.ApiSelectorTest.InstanceMethods) 8 errors found in 26658 instance selector validated: Selector not found for Metal.MTLCounterSampleBufferDescriptor : counterSet Selector not found for Metal.MTLCounterSampleBufferDescriptor : setCounterSet: Selector not found for Metal.MTLCounterSampleBufferDescriptor : label Selector not found for Metal.MTLCounterSampleBufferDescriptor : setLabel: Selector not found for Metal.MTLCounterSampleBufferDescriptor : sampleCount Selector not found for Metal.MTLCounterSampleBufferDescriptor : setSampleCount: Selector not found for Metal.MTLCounterSampleBufferDescriptor : storageMode Selector not found for Metal.MTLCounterSampleBufferDescriptor : setStorageMode: * [introspection] Ignore some API we've bound incorrectly. Fixes #7116. There are also a few API fixes, those will be submitted in a different PR. Fixes https://github.com/xamarin/xamarin-macios/issues/7116.
2019-10-22 23:30:19 +03:00
"Cdrom",
2020-09-15 20:09:18 +03:00
"Celu", // Continuously Differentiable Exponential Linear Unit (ML)
"Chip", // framework name
"Cfa", // acronym: Color Filter Array
"Celp", // MPEG4ObjectID
"Characterteristic",
"Chapv",
[MetalPerformanceShaders] Xcode 9 bindings (#3005) * [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816) * [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938) The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10 * Remove some [Model] attributes that sholdn't be needed * Fix introspection test crashes * More introspection fixes * NN does not need to be PascalCased Remove unneeded Models and BaseTypes * PR Whitespace fixes and renamings * Paste fail * More fixes from PR comments * [MPS] Adds new intro test, fixes ctors and xtro output * Removes duplicated availability attributes. * Removes obsoleted API from macOS since mps is new to it. * Fixes xtro output. * Adds missing API. * Fixes parameterless ctors, some of them do not really work, found by our new intro test and disabled the one that seem to not make sense due to the presence of DesignatedInitializers. * Fixes a selector typo. * Adds new `ShouldNotExposeDefaultCtorTest` to intro. ShouldNotExposeDefaultCtorTest ============================== This test checks for types with a parameterless ctor that are subclasses of `NSObject` and then cheks if the BaseType of said objects also expose a parameterless ctor (all in .NET land), if this is not the case it reports them and so they can manually audited. Also this test has the ability to print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can take this code into an Xcode project and easily tests the ctors. It seems that xtro (sharpie) does not have a complete picture of when a ctor must be exposed hence the hability to generate this code and manually test. Right now this test is just enabled for MPS since it is the scope of this PR. In the future it should be enabled for all other frameworks and the output be manually audited. * [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback. https://bugzilla.xamarin.com/show_bug.cgi?id=59547 * Fixes premature collection possible in bindings im MPSKernel.cs * Fixes MPSImageHistogramTest from using deprecated API. * Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest. * [MPS] Reenable Copy API and DesignatedInitializer xtro feedback * Implement more feedback * More feedback
2017-11-28 23:29:05 +03:00
"Cholesky",
"Chacha",
"Chromaticities",
"Ciexyz",
"Ciff",
"Cinepak",
"Clearcoat",
"Cnn", // Convolutional Neural Network
"Cns",
"Colos",
"Commerical",
"Composable",
"Conflictserror",
"Connnect",
"Counterclock",
"Copyback",
"Craete",
2016-12-13 05:26:23 +03:00
"Crosstraining",
"Cubemap",
2020-09-15 20:09:18 +03:00
"Cmaf", // Common Media Application Format (mpeg4)
"Cmy", // acronym: Cyan, magenta, yellow
"Cmyk", // acronym: Cyan, magenta, yellow and key
"Daap",
"Dav",
"Dcip", // acronym: Digital Cinema Implementation Partners
"Deca",
"Decomposables",
"Deinterlace",
2020-09-15 20:09:18 +03:00
"Depthwise",
"Descendents",
"Descrete",
"Dhe", // Diffie–Hellman key exchange
"Diffable", // that you can diff it.. made up word from apple
"Differental",
"Diffie",
"Directionfor",
"Dist",
"dlclose",
"dlerror",
"Dlfcn",
"dlopen",
"Dls",
"Dlsym",
"dlsym",
"Dng",
"Dns",
"Dont",
"Dop",
"Dopesheet",
"Downsample",
"Downmix", // Sound terminology that means making a stereo mix from a 5.1 surround mix.
"Dpa",
"Dpad", // Directional pad (D-pad)
2020-09-15 20:09:18 +03:00
"Dpads", // plural of above
"Droste",
"Dtls",
"Dtmf", // DTMF
"dy",
"Eap",
"Ebu",
"Ecc", // Elliptic Curve Cryptography
"Ecdh", // Elliptic Curve Diffie–Hellman
"Ecdhe", // Elliptic Curve Diffie-Hellman Ephemeral
"Ecdsa", // Elliptic Curve Digital Signature Algorithm
"Ecies", // Elliptic Curve Integrated Encryption Scheme
"Ecn", // Explicit Congestion Notification
"Ect", // ECN Capable Transport
"Editability",
"Edr",
"Eof", // acronym End-Of-File
[MetalPerformanceShaders] Xcode 9 bindings (#3005) * [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816) * [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938) The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10 * Remove some [Model] attributes that sholdn't be needed * Fix introspection test crashes * More introspection fixes * NN does not need to be PascalCased Remove unneeded Models and BaseTypes * PR Whitespace fixes and renamings * Paste fail * More fixes from PR comments * [MPS] Adds new intro test, fixes ctors and xtro output * Removes duplicated availability attributes. * Removes obsoleted API from macOS since mps is new to it. * Fixes xtro output. * Adds missing API. * Fixes parameterless ctors, some of them do not really work, found by our new intro test and disabled the one that seem to not make sense due to the presence of DesignatedInitializers. * Fixes a selector typo. * Adds new `ShouldNotExposeDefaultCtorTest` to intro. ShouldNotExposeDefaultCtorTest ============================== This test checks for types with a parameterless ctor that are subclasses of `NSObject` and then cheks if the BaseType of said objects also expose a parameterless ctor (all in .NET land), if this is not the case it reports them and so they can manually audited. Also this test has the ability to print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can take this code into an Xcode project and easily tests the ctors. It seems that xtro (sharpie) does not have a complete picture of when a ctor must be exposed hence the hability to generate this code and manually test. Right now this test is just enabled for MPS since it is the scope of this PR. In the future it should be enabled for all other frameworks and the output be manually audited. * [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback. https://bugzilla.xamarin.com/show_bug.cgi?id=59547 * Fixes premature collection possible in bindings im MPSKernel.cs * Fixes MPSImageHistogramTest from using deprecated API. * Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest. * [MPS] Reenable Copy API and DesignatedInitializer xtro feedback * Implement more feedback * More feedback
2017-11-28 23:29:05 +03:00
"Elu",
"Emagic",
"Emaili",
"Embd",
"Emsg", // 4cc
"Enc",
"Eppc",
2020-09-15 20:09:18 +03:00
"Epub",
2018-08-01 04:22:30 +03:00
"Eftpos", // Electronic funds transfer at point of sale
"Eotf", // DisplayP3_PQ_Eotf
"Exabits",
"Exbibits",
"Exbibytes",
"Exhange",
"Exp",
"Expr",
"Exr",
"Felica", // Japanese contactless RFID smart card system
"Femtowatts",
"Fhir",
"Flipside",
"Formati",
"Fov",
"Framebuffer",
"Framesetter",
"Froms", // NSMetadataItemWhereFromsKey
"Freq",
"Ftps",
"Func",
"Gadu",
"Gbrg", // acronym for Green-Blue-Reg-Green
2020-09-15 20:09:18 +03:00
"Gelu", // Gaussian Error Linear Unit (ML)
"Geocoder",
"Gigapascals",
"Gibibits",
"Gibibytes",
2020-09-15 20:09:18 +03:00
"Girocard",
"Glorot", // NN
"Gop", // acronym for Group Of Pictures
"Gpp",
"Gps",
"Gpu", // acronym for Graphics Processing Unit
"Grbg", // acronym for Green-Red-Blue-Green
"Gru",
"Greeking",
"Gtin",
2020-09-15 20:09:18 +03:00
"Gui",
"Hardlink",
"Heics", // High Efficiency Image File Format (Sequence)
"Hdmi",
"Hdr",
"Hectopascals",
"Heic", // file type
"Heif", // file type
"Hevc", // CMVideoCodecType / High Efficiency Video Coding
"Heif", // High Efficiency Image File Format
"Hfp",
"Hipass",
"Hlg", // Hybrid Log-Gamma
"Hls",
"Hoa",
"Hrtf", // acronym used in AUSpatializationAlgorithm
"Hvxc", // MPEG4ObjectID
2020-09-15 20:09:18 +03:00
"Icns",
"Ico",
"Ies",
"Icq",
"Ident",
"Identd",
2017-09-15 04:42:40 +03:00
"Imageblock",
"Imagefor",
"Imap",
"Imaps",
"Img",
Add a BindingImpl attribute and use to to teach the linker look for it to search for optimizable code. (#3299) * [ObjCRuntime] Add a BindingImplAttribute. * [linker] Make ProviderToString an extension method on ICustomAttributeProvider to make it more discoverable. * [generator] Use [BindingImpl] instead of [CompilerGenerated]. The entire diff is big (89MB), so it can't be gisted. However, most of it is either removal of `using System.Runtime.CompilerServices;` or the change from `[CompilerGenerated]` to `[BindingImpl (...)]` like this: https://gist.github.com/rolfbjarne/8bfda3ed37b956d0342a1c1e9b079244 If I remove those parts of the diff, there's nothing significant left: https://gist.github.com/rolfbjarne/4156164d6bdb1376366200394eb8a091 * [linker] Teach the linker about the new [BindingImpl] attribute. In addition to the existing logic where the linker would optimize some [CompilerGenerated] code (sometimes with additional requirements), it will now also optimize all [BindingImpl (Optimizable)] code (without any additional requirements). * [tests] Add tests to make sure [BindingImpl (Optimizable)] works as expected. * [linker] Check for [BindingImpl] before [CompilerGenerated] and stop checking for [CompilerGenerated] in XAMCORE_4_0. Check for [BindingImpl] before checking for [CompilerGenerated], since the former is more common. Also stop checking for [CompilerGenerated] (at least to mean that code is optimizable) in our next non-compatible evolutionary leap (XAMCORE_4_0): * [introspection] Impl a better typo check.
2018-01-26 20:38:23 +03:00
"Impl", // BindingImplAttribute
"Inv",
2016-12-13 05:26:23 +03:00
"Indoorrun",
"Indoorcycle",
"Inklist",
"Indeterm",
2016-12-13 05:26:23 +03:00
"Indoorwalk",
"Inode",
"Inser",
"Instamatic",
"Interac",
"Interframe",
"Interitem",
"Intermenstrual",
"Intersector",
"Intoi",
2020-09-15 20:09:18 +03:00
"Invitable",
"Ios",
"Iou",
"Ipa",
"Ipp",
"Iptc",
"Ircs",
"Iso",
"Itf",
"Itu",
"Itur", // Itur_2020_Hlg
"Jcb", // Japanese credit card company
"Jfif",
"Jis",
"Json",
"Keyerror",
"Keyi",
[MetalPerformanceShaders] Xcode 9 bindings (#3005) * [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816) * [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938) The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10 * Remove some [Model] attributes that sholdn't be needed * Fix introspection test crashes * More introspection fixes * NN does not need to be PascalCased Remove unneeded Models and BaseTypes * PR Whitespace fixes and renamings * Paste fail * More fixes from PR comments * [MPS] Adds new intro test, fixes ctors and xtro output * Removes duplicated availability attributes. * Removes obsoleted API from macOS since mps is new to it. * Fixes xtro output. * Adds missing API. * Fixes parameterless ctors, some of them do not really work, found by our new intro test and disabled the one that seem to not make sense due to the presence of DesignatedInitializers. * Fixes a selector typo. * Adds new `ShouldNotExposeDefaultCtorTest` to intro. ShouldNotExposeDefaultCtorTest ============================== This test checks for types with a parameterless ctor that are subclasses of `NSObject` and then cheks if the BaseType of said objects also expose a parameterless ctor (all in .NET land), if this is not the case it reports them and so they can manually audited. Also this test has the ability to print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can take this code into an Xcode project and easily tests the ctors. It seems that xtro (sharpie) does not have a complete picture of when a ctor must be exposed hence the hability to generate this code and manually test. Right now this test is just enabled for MPS since it is the scope of this PR. In the future it should be enabled for all other frameworks and the output be manually audited. * [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback. https://bugzilla.xamarin.com/show_bug.cgi?id=59547 * Fixes premature collection possible in bindings im MPSKernel.cs * Fixes MPSImageHistogramTest from using deprecated API. * Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest. * [MPS] Reenable Copy API and DesignatedInitializer xtro feedback * Implement more feedback * More feedback
2017-11-28 23:29:05 +03:00
"Keypoint",
"Keypoints",
"Keyspace",
"ks",
"Kibibits",
"Kibibytes",
"Kiloampere",
"Kiloamperes",
"Kiloohms",
"Kilopascals",
"Kullback", // Kullback-Leibler Divergence
"Langauges",
"Lacunarity",
"Latm", // Low Overhead Audio Transport Multiplex
"Ldaps",
"Lerp",
"Linecap",
"Lingustic",
"libcompression",
"libdispatch",
"Loas", // Low Overhead Audio Stream
"Lod",
"Lopass",
"Lowlevel",
"Lstm",
[MetalPerformanceShaders] Xcode 9 bindings (#3005) * [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816) * [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938) The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10 * Remove some [Model] attributes that sholdn't be needed * Fix introspection test crashes * More introspection fixes * NN does not need to be PascalCased Remove unneeded Models and BaseTypes * PR Whitespace fixes and renamings * Paste fail * More fixes from PR comments * [MPS] Adds new intro test, fixes ctors and xtro output * Removes duplicated availability attributes. * Removes obsoleted API from macOS since mps is new to it. * Fixes xtro output. * Adds missing API. * Fixes parameterless ctors, some of them do not really work, found by our new intro test and disabled the one that seem to not make sense due to the presence of DesignatedInitializers. * Fixes a selector typo. * Adds new `ShouldNotExposeDefaultCtorTest` to intro. ShouldNotExposeDefaultCtorTest ============================== This test checks for types with a parameterless ctor that are subclasses of `NSObject` and then cheks if the BaseType of said objects also expose a parameterless ctor (all in .NET land), if this is not the case it reports them and so they can manually audited. Also this test has the ability to print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can take this code into an Xcode project and easily tests the ctors. It seems that xtro (sharpie) does not have a complete picture of when a ctor must be exposed hence the hability to generate this code and manually test. Right now this test is just enabled for MPS since it is the scope of this PR. In the future it should be enabled for all other frameworks and the output be manually audited. * [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback. https://bugzilla.xamarin.com/show_bug.cgi?id=59547 * Fixes premature collection possible in bindings im MPSKernel.cs * Fixes MPSImageHistogramTest from using deprecated API. * Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest. * [MPS] Reenable Copy API and DesignatedInitializer xtro feedback * Implement more feedback * More feedback
2017-11-28 23:29:05 +03:00
"Lun",
"Luma",
"Lzfse", // acronym
"Lzma", // acronym
"Mada", // payment system
"Mapbuffer",
"Matchingcoalesce",
2020-09-15 20:09:18 +03:00
"Mcp", // metacarpophalangeal (hand)
"Mebibits",
"Mebibytes",
"Megaampere",
"Megaamperes",
"Megaliters",
"Megameters",
"Megaohms",
"Megapascals",
"Metacharacters",
"Metalness",
"Metadatas",
"Microampere",
"Microamperes",
"Microohms",
"Microwatts",
"Millimoles",
"Milliohms",
"Mimap",
"Minification",
"Mncs",
2020-09-15 20:09:18 +03:00
"Mgmt",
"Mobike", // acronym
"Morpher",
2020-01-31 23:02:52 +03:00
"mtouch",
"Mpe", // acronym
[MetalPerformanceShaders] Xcode 9 bindings (#3005) * [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816) * [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938) The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10 * Remove some [Model] attributes that sholdn't be needed * Fix introspection test crashes * More introspection fixes * NN does not need to be PascalCased Remove unneeded Models and BaseTypes * PR Whitespace fixes and renamings * Paste fail * More fixes from PR comments * [MPS] Adds new intro test, fixes ctors and xtro output * Removes duplicated availability attributes. * Removes obsoleted API from macOS since mps is new to it. * Fixes xtro output. * Adds missing API. * Fixes parameterless ctors, some of them do not really work, found by our new intro test and disabled the one that seem to not make sense due to the presence of DesignatedInitializers. * Fixes a selector typo. * Adds new `ShouldNotExposeDefaultCtorTest` to intro. ShouldNotExposeDefaultCtorTest ============================== This test checks for types with a parameterless ctor that are subclasses of `NSObject` and then cheks if the BaseType of said objects also expose a parameterless ctor (all in .NET land), if this is not the case it reports them and so they can manually audited. Also this test has the ability to print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can take this code into an Xcode project and easily tests the ctors. It seems that xtro (sharpie) does not have a complete picture of when a ctor must be exposed hence the hability to generate this code and manually test. Right now this test is just enabled for MPS since it is the scope of this PR. In the future it should be enabled for all other frameworks and the output be manually audited. * [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback. https://bugzilla.xamarin.com/show_bug.cgi?id=59547 * Fixes premature collection possible in bindings im MPSKernel.cs * Fixes MPSImageHistogramTest from using deprecated API. * Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest. * [MPS] Reenable Copy API and DesignatedInitializer xtro feedback * Implement more feedback * More feedback
2017-11-28 23:29:05 +03:00
"Mps",
2020-09-15 20:09:18 +03:00
"Msaa", // multisample anti-aliasing
"Mtu", // acronym
"Mtc", // acronym
"Mtgp",
"Mul",
"Mult",
2020-09-15 20:09:18 +03:00
"Multihead",
2017-08-15 15:32:51 +03:00
"Multipath",
"Multipeer",
"Muxed",
"Nai",
"Nanograms",
"Nanowatts",
"Nestrov",
2020-09-15 20:09:18 +03:00
"Nesterov",
"nfloat",
"Nfnt",
"nint",
"Nntps",
"Ntlm",
Fix a few introspection issues on Catalina. (#7212) (#7243) * [SceneKit] Adjust deprecation message. Fixes this introspection failure: [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Type: SCNLayer [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: get_OpenGLContext, Type: SCNView [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: set_OpenGLContext, Type: SCNView [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: get_PixelFormat, Type: SCNView [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: set_PixelFormat, Type: SCNView * [AppKit] Adjust deprecation messages. * [tests] Fix introspection and xammac tests on Catalina. (#7200) * [tests] Adjust NaturalLanguage.EmbeddingTest to cope with non-existent embeddings. Fixes xamarin/maccore#2011. Fixes https://github.com/xamarin/maccore/issues/2011. * [tests] Fix typo test on macOS 10.15. Fixes #7116. Fixes https://github.com/xamarin/xamarin-macios/issues/7116. * [introspection] Ignore MTLCounterSampleBufferDescriptor's selectors. They're implemented using a different/internal type: $ nm /System/Library/Frameworks/Metal.framework/Metal | grep MTLCounterSampleBuffer 00000000000458ab t +[MTLCounterSampleBufferDescriptor allocWithZone:] 0000000000045897 t +[MTLCounterSampleBufferDescriptor alloc] 000000000004591e t -[MTLCounterSampleBufferDescriptor copyWithZone:] 000000000004598e t -[MTLCounterSampleBufferDescriptorInternal copyWithZone:] 0000000000045c0f t -[MTLCounterSampleBufferDescriptorInternal counterSet] 0000000000045936 t -[MTLCounterSampleBufferDescriptorInternal dealloc] 0000000000045b65 t -[MTLCounterSampleBufferDescriptorInternal hash] 0000000000045a31 t -[MTLCounterSampleBufferDescriptorInternal isEqual:] 0000000000045c58 t -[MTLCounterSampleBufferDescriptorInternal label] 0000000000045c7f t -[MTLCounterSampleBufferDescriptorInternal sampleCount] 0000000000045c25 t -[MTLCounterSampleBufferDescriptorInternal setCounterSet:] 0000000000045c6e t -[MTLCounterSampleBufferDescriptorInternal setLabel:] 0000000000045c90 t -[MTLCounterSampleBufferDescriptorInternal setSampleCount:] 0000000000045c47 t -[MTLCounterSampleBufferDescriptorInternal setStorageMode:] 0000000000045c36 t -[MTLCounterSampleBufferDescriptorInternal storageMode] 000000000010b0b8 S _OBJC_CLASS_$_MTLCounterSampleBufferDescriptor 000000000010b0e0 S _OBJC_CLASS_$_MTLCounterSampleBufferDescriptorInternal 0000000000107070 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._counterSet 0000000000107078 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._label 0000000000107088 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._sampleCount 0000000000107080 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._storageMode 000000000010b108 S _OBJC_METACLASS_$_MTLCounterSampleBufferDescriptor 000000000010b130 S _OBJC_METACLASS_$_MTLCounterSampleBufferDescriptorInternal Fixes these test failures: 1) ApiSelectorTest.InstanceMethods (Introspection.MacApiSelectorTest.ApiSelectorTest.InstanceMethods) 8 errors found in 26658 instance selector validated: Selector not found for Metal.MTLCounterSampleBufferDescriptor : counterSet Selector not found for Metal.MTLCounterSampleBufferDescriptor : setCounterSet: Selector not found for Metal.MTLCounterSampleBufferDescriptor : label Selector not found for Metal.MTLCounterSampleBufferDescriptor : setLabel: Selector not found for Metal.MTLCounterSampleBufferDescriptor : sampleCount Selector not found for Metal.MTLCounterSampleBufferDescriptor : setSampleCount: Selector not found for Metal.MTLCounterSampleBufferDescriptor : storageMode Selector not found for Metal.MTLCounterSampleBufferDescriptor : setStorageMode: * [introspection] Ignore some API we've bound incorrectly. Fixes #7116. There are also a few API fixes, those will be submitted in a different PR. Fixes https://github.com/xamarin/xamarin-macios/issues/7116.
2019-10-22 23:30:19 +03:00
"Nsl", // InternetLocationNslNeighborhoodIcon
"Ntsc",
"nuint",
"Ndef",
"Noi", // From NoiOSAttribute
"Nop",
"Numbernumber",
"Nyquist",
"Oaep", // Optimal asymmetric encryption padding
"Objectfor",
"Objectness",
"Occlussion",
"Ocurrences",
"Ocsp", // Online Certificate Status Protocol
"Octree",
"Oid",
"Oneup", // TVElementKeyOneupTemplate
"Organisation", // kCGImagePropertyIPTCExtRegistryOrganisationID in Xcode9.3-b1
"Orthographyrange",
"Orth",
2020-09-15 20:09:18 +03:00
"Osa", // Open Scripting Architecture
"Otsu", // threshold for image binarization
"ove",
"Paeth", // PNG filter
"Palettize",
"Parms", // short for Parameters
"Peap",
"Pebibits",
"Pebibytes",
"Petabits",
"Perlin",
"Persistable",
"Pausable",
"Pcl",
"Pcm",
"Pdu",
"Persistance",
"Pesented",
"Pfs", // acronym
"Philox",
"Picometers",
"Picowatts",
"Pkcs",
"Placemark",
"Playthrough",
2020-09-15 20:09:18 +03:00
"Pnc", // MIDI
[MetalPerformanceShaders] Xcode 9 bindings (#3005) * [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816) * [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938) The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10 * Remove some [Model] attributes that sholdn't be needed * Fix introspection test crashes * More introspection fixes * NN does not need to be PascalCased Remove unneeded Models and BaseTypes * PR Whitespace fixes and renamings * Paste fail * More fixes from PR comments * [MPS] Adds new intro test, fixes ctors and xtro output * Removes duplicated availability attributes. * Removes obsoleted API from macOS since mps is new to it. * Fixes xtro output. * Adds missing API. * Fixes parameterless ctors, some of them do not really work, found by our new intro test and disabled the one that seem to not make sense due to the presence of DesignatedInitializers. * Fixes a selector typo. * Adds new `ShouldNotExposeDefaultCtorTest` to intro. ShouldNotExposeDefaultCtorTest ============================== This test checks for types with a parameterless ctor that are subclasses of `NSObject` and then cheks if the BaseType of said objects also expose a parameterless ctor (all in .NET land), if this is not the case it reports them and so they can manually audited. Also this test has the ability to print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can take this code into an Xcode project and easily tests the ctors. It seems that xtro (sharpie) does not have a complete picture of when a ctor must be exposed hence the hability to generate this code and manually test. Right now this test is just enabled for MPS since it is the scope of this PR. In the future it should be enabled for all other frameworks and the output be manually audited. * [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback. https://bugzilla.xamarin.com/show_bug.cgi?id=59547 * Fixes premature collection possible in bindings im MPSKernel.cs * Fixes MPSImageHistogramTest from using deprecated API. * Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest. * [MPS] Reenable Copy API and DesignatedInitializer xtro feedback * Implement more feedback * More feedback
2017-11-28 23:29:05 +03:00
"Pnorm",
"Pointillize",
"Polyline",
"Polylines",
"Popularimeter",
"Preds", // short for Predicates
"Prerolls",
"Preseti",
"Prev",
Fix a few introspection issues on Catalina. (#7212) (#7243) * [SceneKit] Adjust deprecation message. Fixes this introspection failure: [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Type: SCNLayer [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: get_OpenGLContext, Type: SCNView [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: set_OpenGLContext, Type: SCNView [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: get_PixelFormat, Type: SCNView [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: set_PixelFormat, Type: SCNView * [AppKit] Adjust deprecation messages. * [tests] Fix introspection and xammac tests on Catalina. (#7200) * [tests] Adjust NaturalLanguage.EmbeddingTest to cope with non-existent embeddings. Fixes xamarin/maccore#2011. Fixes https://github.com/xamarin/maccore/issues/2011. * [tests] Fix typo test on macOS 10.15. Fixes #7116. Fixes https://github.com/xamarin/xamarin-macios/issues/7116. * [introspection] Ignore MTLCounterSampleBufferDescriptor's selectors. They're implemented using a different/internal type: $ nm /System/Library/Frameworks/Metal.framework/Metal | grep MTLCounterSampleBuffer 00000000000458ab t +[MTLCounterSampleBufferDescriptor allocWithZone:] 0000000000045897 t +[MTLCounterSampleBufferDescriptor alloc] 000000000004591e t -[MTLCounterSampleBufferDescriptor copyWithZone:] 000000000004598e t -[MTLCounterSampleBufferDescriptorInternal copyWithZone:] 0000000000045c0f t -[MTLCounterSampleBufferDescriptorInternal counterSet] 0000000000045936 t -[MTLCounterSampleBufferDescriptorInternal dealloc] 0000000000045b65 t -[MTLCounterSampleBufferDescriptorInternal hash] 0000000000045a31 t -[MTLCounterSampleBufferDescriptorInternal isEqual:] 0000000000045c58 t -[MTLCounterSampleBufferDescriptorInternal label] 0000000000045c7f t -[MTLCounterSampleBufferDescriptorInternal sampleCount] 0000000000045c25 t -[MTLCounterSampleBufferDescriptorInternal setCounterSet:] 0000000000045c6e t -[MTLCounterSampleBufferDescriptorInternal setLabel:] 0000000000045c90 t -[MTLCounterSampleBufferDescriptorInternal setSampleCount:] 0000000000045c47 t -[MTLCounterSampleBufferDescriptorInternal setStorageMode:] 0000000000045c36 t -[MTLCounterSampleBufferDescriptorInternal storageMode] 000000000010b0b8 S _OBJC_CLASS_$_MTLCounterSampleBufferDescriptor 000000000010b0e0 S _OBJC_CLASS_$_MTLCounterSampleBufferDescriptorInternal 0000000000107070 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._counterSet 0000000000107078 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._label 0000000000107088 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._sampleCount 0000000000107080 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._storageMode 000000000010b108 S _OBJC_METACLASS_$_MTLCounterSampleBufferDescriptor 000000000010b130 S _OBJC_METACLASS_$_MTLCounterSampleBufferDescriptorInternal Fixes these test failures: 1) ApiSelectorTest.InstanceMethods (Introspection.MacApiSelectorTest.ApiSelectorTest.InstanceMethods) 8 errors found in 26658 instance selector validated: Selector not found for Metal.MTLCounterSampleBufferDescriptor : counterSet Selector not found for Metal.MTLCounterSampleBufferDescriptor : setCounterSet: Selector not found for Metal.MTLCounterSampleBufferDescriptor : label Selector not found for Metal.MTLCounterSampleBufferDescriptor : setLabel: Selector not found for Metal.MTLCounterSampleBufferDescriptor : sampleCount Selector not found for Metal.MTLCounterSampleBufferDescriptor : setSampleCount: Selector not found for Metal.MTLCounterSampleBufferDescriptor : storageMode Selector not found for Metal.MTLCounterSampleBufferDescriptor : setStorageMode: * [introspection] Ignore some API we've bound incorrectly. Fixes #7116. There are also a few API fixes, those will be submitted in a different PR. Fixes https://github.com/xamarin/xamarin-macios/issues/7116.
2019-10-22 23:30:19 +03:00
"Privs", // SharingPrivsNotApplicableIcon
"Propogate",
"Psec",
"Psm", // Protocol/Service Multiplexer
"Psk",
"Ptp",
"Pvrtc", // MTLBlitOption - PowerVR Texture Compression
2019-01-17 20:40:58 +03:00
"Qos",
"Quaterniond",
"Quadding",
"Qura",
2017-01-26 21:45:07 +03:00
"Quic",
"Reacquirer",
"Reinvitation",
"Reinvite",
"Rel",
"Relocalization",
2020-09-15 20:09:18 +03:00
"Relu", // Rectified Linear Unit (ML)
"Relun", // ReLUn - degree n Hermite coefficients
"Reprandial",
"Replayable",
"Requestwith",
"Ridesharing",
"Rgb",
"Rgba",
"Rggb", // acronym for Red, Green, Green, Blue
[MetalPerformanceShaders] Xcode 9 bindings (#3005) * [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816) * [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938) The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10 * Remove some [Model] attributes that sholdn't be needed * Fix introspection test crashes * More introspection fixes * NN does not need to be PascalCased Remove unneeded Models and BaseTypes * PR Whitespace fixes and renamings * Paste fail * More fixes from PR comments * [MPS] Adds new intro test, fixes ctors and xtro output * Removes duplicated availability attributes. * Removes obsoleted API from macOS since mps is new to it. * Fixes xtro output. * Adds missing API. * Fixes parameterless ctors, some of them do not really work, found by our new intro test and disabled the one that seem to not make sense due to the presence of DesignatedInitializers. * Fixes a selector typo. * Adds new `ShouldNotExposeDefaultCtorTest` to intro. ShouldNotExposeDefaultCtorTest ============================== This test checks for types with a parameterless ctor that are subclasses of `NSObject` and then cheks if the BaseType of said objects also expose a parameterless ctor (all in .NET land), if this is not the case it reports them and so they can manually audited. Also this test has the ability to print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can take this code into an Xcode project and easily tests the ctors. It seems that xtro (sharpie) does not have a complete picture of when a ctor must be exposed hence the hability to generate this code and manually test. Right now this test is just enabled for MPS since it is the scope of this PR. In the future it should be enabled for all other frameworks and the output be manually audited. * [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback. https://bugzilla.xamarin.com/show_bug.cgi?id=59547 * Fixes premature collection possible in bindings im MPSKernel.cs * Fixes MPSImageHistogramTest from using deprecated API. * Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest. * [MPS] Reenable Copy API and DesignatedInitializer xtro feedback * Implement more feedback * More feedback
2017-11-28 23:29:05 +03:00
"Rnn",
"Roi",
"Romm", // acronym: Reference Output Medium Metric
"Rpa",
"Rpn", // acronym
"Rsa", // Rivest, Shamir and Adleman
2020-09-15 20:09:18 +03:00
"Rsqrt", // reciprocal square root
"Rssi",
"Rtp",
"Rtl",
"Rtsp",
"Saml", // acronym
"Sdof",
"Scn",
"Sdk",
"Sdtv", // acronym: Standard Definition Tele Vision
"Sdnn",
"Seekable",
2020-09-15 20:09:18 +03:00
"Selu", // Scaled Exponential Linear unit (ML)
"Sgd", // Stochastic Gradient Descent (ML)
"Shadable",
"Sharegroup",
"Sha", // Secure Hash Algorithm
"Siemen",
"simd",
"Sinh",
"Sint", // as in "Signed Integer"
"Simd",
"Slerp",
"Slomo",
"Smpte",
"Snapshotter",
"Snorm",
"Sobel",
"Softmax", // get_SoftmaxNormalization
"Spacei",
"Sqrt",
"Srgb",
"Ssid",
"Ssids",
"Standarize",
"Stateful",
"Stateright",
"Subbeat",
"Subcaption",
"Subcardioid",
"Subentities",
"Subheadline",
"Sublocality",
"Sublocation",
"Submesh",
"Submeshes",
"Subpixel",
"Subresource",
"Subresources",
"Subsec",
"Suica", // Japanese contactless smart card type
"Superentity",
2020-09-15 20:09:18 +03:00
"Supertype",
"Supertypes",
"Svg", // Scalable Vector Graphics
"Sym",
"Synchronizable",
"Symbologies",
"Tanh",
"Tebibits",
"Tebibytes",
[MetalPerformanceShaders] Xcode 9 bindings (#3005) * [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816) * [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938) The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10 * Remove some [Model] attributes that sholdn't be needed * Fix introspection test crashes * More introspection fixes * NN does not need to be PascalCased Remove unneeded Models and BaseTypes * PR Whitespace fixes and renamings * Paste fail * More fixes from PR comments * [MPS] Adds new intro test, fixes ctors and xtro output * Removes duplicated availability attributes. * Removes obsoleted API from macOS since mps is new to it. * Fixes xtro output. * Adds missing API. * Fixes parameterless ctors, some of them do not really work, found by our new intro test and disabled the one that seem to not make sense due to the presence of DesignatedInitializers. * Fixes a selector typo. * Adds new `ShouldNotExposeDefaultCtorTest` to intro. ShouldNotExposeDefaultCtorTest ============================== This test checks for types with a parameterless ctor that are subclasses of `NSObject` and then cheks if the BaseType of said objects also expose a parameterless ctor (all in .NET land), if this is not the case it reports them and so they can manually audited. Also this test has the ability to print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can take this code into an Xcode project and easily tests the ctors. It seems that xtro (sharpie) does not have a complete picture of when a ctor must be exposed hence the hability to generate this code and manually test. Right now this test is just enabled for MPS since it is the scope of this PR. In the future it should be enabled for all other frameworks and the output be manually audited. * [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback. https://bugzilla.xamarin.com/show_bug.cgi?id=59547 * Fixes premature collection possible in bindings im MPSKernel.cs * Fixes MPSImageHistogramTest from using deprecated API. * Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest. * [MPS] Reenable Copy API and DesignatedInitializer xtro feedback * Implement more feedback * More feedback
2017-11-28 23:29:05 +03:00
"Tensorflow",
"Tessellator",
"Texcoord",
"Texel",
"th",
"Threadgroup",
"Threadgroups",
"Thumbnailing",
"Thumbstick",
"Thumbsticks",
"Timecodes",
"Timelapse",
"Timelapses",
"Tls",
"Ttls",
"Tlv",
"Toc",
"Toci",
"Toi",
"Transceive",
[CoreGraphics] Implement CoreGraphics bindings for Xcode 9. (#2812) * [ios11-b1] CoreGraphics bindings * Updated with feedback from Sebastien * Fix build, optimize checks * Add version information * Address comments * Tests * Remove Apply code, add special code for typo * [CoreGraphics] Add comma after last enum value. * [CoreGraphics] No need to bind CGColorSpaceGetName. * [CoreGraphics] Add new field in Xcode 9 beta 5. * [CoreGraphics] Move kCGPDFContextAccessPermissions to the correct dictionary container and implement the corresponding manual code. * [CoreGraphics] Adjust nullability acceptance based on new attributes for CGColorSpace.CreateCalibratedGray/RGB functions. * [CoreGraphics] Bind CGColorSpaceCreateLab, introduced in Xcode 9 beta 5. * [CoreGraphics] Adjust CGColorSpaceCreateWithICCData and CGColorSpaceCreateWithICCProfile bindings according to Xcode 9 beta 2. Apple introduced CGColorSpaceCreateWithICCData in b1, and made CGColorSpaceCreateWithICCProfile a typedef to CGColorSpaceCreateWithICCData. Apple reversed the typedef in b2 (probably because it creates broken executables when targetting earlier versions of macOS, since those executables would use CGColorSpaceCreateWithICCData, which would not exist), and instead made CGColorSpaceCreateWithICCProfile a normal deprecated method. So copy this logic in our bindings: deprecate CreateICCProfile, and introduce CreateICCProfile, with two overloads for NSData and CGDataProvider (since that's what's accepted according to the documentation). * [CoreGraphics] Add CGContextPDF constructors to make parity between different overloads. There are two types of CGContextPDF constructors: the first argument is either an NSUrl or a CGDataConsumer. Previously the NSUrl type had more overloads, and also allowed a null CGRect for the second argument. With the overloads are identical between the two types of CGContextPDF constructors. Existing constructors: CGContextPDF (NSUrl, CGRect, CGPDFInfo) CGContextPDF (NSUrl, CGRect) CGContextPDF (NSUrl, CGPDFInfo) CGContextPDF (NSUrl) CGContextPDF (CGDataConsumer, CGRect, CGPDFInfo) Added constructors: CGContextPDF (CGDataConsumer, CGRect) CGContextPDF (CGDataConsumer, CGPDFInfo) CGContextPDF (CGDataConsumer) Additionally the code has been fixed to not throw NullReferenceExceptions if null is passed for any of the values and instead pass on any null values to the native `CGPDFContextCreate` method (since `CGPDFContextCreate`'s arguments are all `__nullable`). * [tests] Add and improve existing tests for new and some existing CoreGraphics API. * Undo accidental whitespace noise. * [tests] Remove random characters in assert message. * [CoreGraphics] Improve argument exception messages in CGColorSpace according to review. * [CoreGraphics] Use 'Icc' instead of 'ICC' for new API, and also make the change for XAMCORE_4_0. * [CoreGraphics] Fix availability attribute for High Sierra. * [tests] Update monotouch-test after API changes.
2017-10-02 13:02:41 +03:00
"Trc",
"Truncantion",
"Tweening",
"Twips",
"tx",
"ty",
"Udi",
"Udp",
"Unconfigured",
"Undecodable",
2018-07-02 14:45:34 +03:00
"Unemphasized",
"Underrun",
"Unflagged",
"Unfocusing",
2020-09-15 20:09:18 +03:00
"Uid",
"Unmap",
"Unorm",
"Unpremultiplied",
"Unpremultiplying",
"Unprepare",
"Unproject",
"Unpublish",
"Uterance",
"Unentitled",
"Untrash",
"Utf",
"Upce",
"Uri",
"Usac", // Unified Speech and Audio Coding
2020-09-15 20:09:18 +03:00
"Usd", // Universal Scene Description
"Usdz", // USD zip
"Uti",
"Varispeed",
"Vergence",
"Voronoi",
"Vnode",
"Vpn",
"Warichu",
"Wep",
"Wpa",
"Warpable",
"Whitespaces",
2019-07-24 22:57:29 +03:00
"Wifes",
"Writeability",
[MetalPerformanceShaders] Xcode 9 bindings (#3005) * [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816) * [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938) The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10 * Remove some [Model] attributes that sholdn't be needed * Fix introspection test crashes * More introspection fixes * NN does not need to be PascalCased Remove unneeded Models and BaseTypes * PR Whitespace fixes and renamings * Paste fail * More fixes from PR comments * [MPS] Adds new intro test, fixes ctors and xtro output * Removes duplicated availability attributes. * Removes obsoleted API from macOS since mps is new to it. * Fixes xtro output. * Adds missing API. * Fixes parameterless ctors, some of them do not really work, found by our new intro test and disabled the one that seem to not make sense due to the presence of DesignatedInitializers. * Fixes a selector typo. * Adds new `ShouldNotExposeDefaultCtorTest` to intro. ShouldNotExposeDefaultCtorTest ============================== This test checks for types with a parameterless ctor that are subclasses of `NSObject` and then cheks if the BaseType of said objects also expose a parameterless ctor (all in .NET land), if this is not the case it reports them and so they can manually audited. Also this test has the ability to print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can take this code into an Xcode project and easily tests the ctors. It seems that xtro (sharpie) does not have a complete picture of when a ctor must be exposed hence the hability to generate this code and manually test. Right now this test is just enabled for MPS since it is the scope of this PR. In the future it should be enabled for all other frameworks and the output be manually audited. * [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback. https://bugzilla.xamarin.com/show_bug.cgi?id=59547 * Fixes premature collection possible in bindings im MPSKernel.cs * Fixes MPSImageHistogramTest from using deprecated API. * Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest. * [MPS] Reenable Copy API and DesignatedInitializer xtro feedback * Implement more feedback * More feedback
2017-11-28 23:29:05 +03:00
"Xnor",
"Xpc",
"xy",
"Xyz",
"Xzy",
"Yobibits",
"Yobibytes",
"Yottabits",
"Yxz",
"Yzx",
"Zxy",
"Zyx",
"Yuv",
"Yuvk",
"yuvs",
"yx",
"yy",
"Yyy",
"Zebibits",
"Zebibytes",
"Zettabits",
"Zlib",
2016-11-22 00:35:57 +03:00
#if MONOMAC
"Abbr",
"Accum",
"Ack", // TcpSetDisableAckStretching
2016-11-22 00:35:57 +03:00
"Addin",
"Addons",
"Appactive",
"Approx",
"Arae",
"Attr",
"Attributesfor",
"Autoresizin",
"Avc",
"Callpout",
"Ccitt",
"Commited",
"Constrainted",
"Ctm",
"Cymk",
"Cymka",
"Cmyka",
"Compat",
"Credendtials",
"Descriptorat",
"Descriptorfor",
"Dimensionsfor",
"Dissapearing",
"Distinguised", // ITLibPlaylistPropertyDistinguisedKind
2016-11-22 00:35:57 +03:00
"Dirs",
"Drm", // MediaItemProperty.IsDrmProtected
2016-11-22 00:35:57 +03:00
"Editability",
"Eisu",
"Entryat",
"Equiv",
"Fourty",
"Grammarl",
"Greeking",
"Hsb",
"Hsba",
"Ibss",
"Iconfor",
"Incrementor",
"Indexeffective",
"Indexestable",
"Itemto",
"Lowsrc",
"Lpcm",
"Lzw",
"Mihret",
"Mps",
"Nonenumerated",
"Nsevent",
"Numberof",
"Orginal",
"Parms",
"Pbm",
"Pde",
"Performwith",
"Phy",
"Pmgt",
"Preceeding",
"Preds",
"Previewable",
"Qtvr",
"Rangewith",
"Rangeswith",
"Reassociation",
"Rectfrom",
"Registeration",
"Segmentnew",
"Semitransient",
"Sixtyfour",
"Sourcei",
"Steppable",
"Stringto",
"Succesfully",
"Supression",
"Targetand",
"Tkip",
"Tsn",
"Tunesi",
"Twentyfour",
"Uneditable",
"Unfocus",
"Unpublish",
"Usec",
"Usedby",
"Viewwrite",
"Wep",
"Wlan",
2016-11-22 00:35:57 +03:00
"Wme",
"Writeln",
"Xattr",
#endif
#if !NET
"Actionfrom",
"Asal", // Typo, should be 'Basal', fixed in 'HKInsulinDeliveryReason'
"Attributefor",
"Attributest",
"Failwith",
"Imageimage",
Fix a few introspection issues on Catalina. (#7212) (#7243) * [SceneKit] Adjust deprecation message. Fixes this introspection failure: [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Type: SCNLayer [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: get_OpenGLContext, Type: SCNView [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: set_OpenGLContext, Type: SCNView [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: get_PixelFormat, Type: SCNView [FAIL] [Rule 4] Don't use availability keywords in attribute's message: "OpenGL API deprecated, please use Metal instead." - Member name: set_PixelFormat, Type: SCNView * [AppKit] Adjust deprecation messages. * [tests] Fix introspection and xammac tests on Catalina. (#7200) * [tests] Adjust NaturalLanguage.EmbeddingTest to cope with non-existent embeddings. Fixes xamarin/maccore#2011. Fixes https://github.com/xamarin/maccore/issues/2011. * [tests] Fix typo test on macOS 10.15. Fixes #7116. Fixes https://github.com/xamarin/xamarin-macios/issues/7116. * [introspection] Ignore MTLCounterSampleBufferDescriptor's selectors. They're implemented using a different/internal type: $ nm /System/Library/Frameworks/Metal.framework/Metal | grep MTLCounterSampleBuffer 00000000000458ab t +[MTLCounterSampleBufferDescriptor allocWithZone:] 0000000000045897 t +[MTLCounterSampleBufferDescriptor alloc] 000000000004591e t -[MTLCounterSampleBufferDescriptor copyWithZone:] 000000000004598e t -[MTLCounterSampleBufferDescriptorInternal copyWithZone:] 0000000000045c0f t -[MTLCounterSampleBufferDescriptorInternal counterSet] 0000000000045936 t -[MTLCounterSampleBufferDescriptorInternal dealloc] 0000000000045b65 t -[MTLCounterSampleBufferDescriptorInternal hash] 0000000000045a31 t -[MTLCounterSampleBufferDescriptorInternal isEqual:] 0000000000045c58 t -[MTLCounterSampleBufferDescriptorInternal label] 0000000000045c7f t -[MTLCounterSampleBufferDescriptorInternal sampleCount] 0000000000045c25 t -[MTLCounterSampleBufferDescriptorInternal setCounterSet:] 0000000000045c6e t -[MTLCounterSampleBufferDescriptorInternal setLabel:] 0000000000045c90 t -[MTLCounterSampleBufferDescriptorInternal setSampleCount:] 0000000000045c47 t -[MTLCounterSampleBufferDescriptorInternal setStorageMode:] 0000000000045c36 t -[MTLCounterSampleBufferDescriptorInternal storageMode] 000000000010b0b8 S _OBJC_CLASS_$_MTLCounterSampleBufferDescriptor 000000000010b0e0 S _OBJC_CLASS_$_MTLCounterSampleBufferDescriptorInternal 0000000000107070 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._counterSet 0000000000107078 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._label 0000000000107088 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._sampleCount 0000000000107080 S _OBJC_IVAR_$_MTLCounterSampleBufferDescriptorInternal._storageMode 000000000010b108 S _OBJC_METACLASS_$_MTLCounterSampleBufferDescriptor 000000000010b130 S _OBJC_METACLASS_$_MTLCounterSampleBufferDescriptorInternal Fixes these test failures: 1) ApiSelectorTest.InstanceMethods (Introspection.MacApiSelectorTest.ApiSelectorTest.InstanceMethods) 8 errors found in 26658 instance selector validated: Selector not found for Metal.MTLCounterSampleBufferDescriptor : counterSet Selector not found for Metal.MTLCounterSampleBufferDescriptor : setCounterSet: Selector not found for Metal.MTLCounterSampleBufferDescriptor : label Selector not found for Metal.MTLCounterSampleBufferDescriptor : setLabel: Selector not found for Metal.MTLCounterSampleBufferDescriptor : sampleCount Selector not found for Metal.MTLCounterSampleBufferDescriptor : setSampleCount: Selector not found for Metal.MTLCounterSampleBufferDescriptor : storageMode Selector not found for Metal.MTLCounterSampleBufferDescriptor : setStorageMode: * [introspection] Ignore some API we've bound incorrectly. Fixes #7116. There are also a few API fixes, those will be submitted in a different PR. Fixes https://github.com/xamarin/xamarin-macios/issues/7116.
2019-10-22 23:30:19 +03:00
"Libary",
"Musthold",
"Olus", // Typo, should be 'Bolus', fixed in 'HKInsulinDeliveryReason'
"Ostprandial", // Typo, should be 'Postprandial', fixed in 'HKBloodGlucoseMealTime'
"Pathpath",
"Rangefor",
"Reprandial", // Typo, should be 'Preprandial', fixed in 'HKBloodGlucoseMealTime'
"Failwith",
"Tearm",
"Theevent",
"Timestampe", // Existing binding so we can't just remove it.
"Toplevel",
"Tripple",
#endif
};
// ease maintenance of the list
HashSet<string> used = new HashSet<string> ();
bool SkipAllowed (string typeName, string methodName, string typo)
{
if (allowed.Contains (typo)) {
used.Add (typo);
return true;
}
return false;
}
bool IsObsolete (MemberInfo mi)
{
if (mi is null)
return false;
if (mi.GetCustomAttributes<ObsoleteAttribute> (true).Any ())
return true;
if (MemberHasObsolete (mi))
return true;
return IsObsolete (mi.DeclaringType);
}
[Test]
public virtual void AttributeTypoTest ()
{
var types = Assembly.GetTypes ();
int totalErrors = 0;
foreach (Type t in types)
AttributeTypo (t, ref totalErrors);
Assert.AreEqual (0, totalErrors, "Attributes have typos!");
}
void AttributeTypo (Type t, ref int totalErrors)
{
AttributesMessageTypoRules (t, t.Name, ref totalErrors);
var flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
foreach (var f in t.GetFields (flags))
AttributesMessageTypoRules (f, t.Name, ref totalErrors);
foreach (var p in t.GetProperties (flags))
AttributesMessageTypoRules (p, t.Name, ref totalErrors);
foreach (var m in t.GetMethods (flags))
AttributesMessageTypoRules (m, t.Name, ref totalErrors);
foreach (var e in t.GetEvents (flags))
AttributesMessageTypoRules (e, t.Name, ref totalErrors);
foreach (var nt in t.GetNestedTypes ())
AttributeTypo (nt, ref totalErrors);
}
[Test]
public virtual void TypoTest ()
{
var types = Assembly.GetTypes ();
int totalErrors = 0;
foreach (Type t in types) {
if (t.IsPublic) {
if (IsObsolete (t))
continue;
string txt = NameCleaner (t.Name);
var typo = GetCachedTypo (txt);
if (typo.Length > 0) {
if (!Skip (t, typo)) {
ReportError ("Typo in TYPE: {0} - {1} ", t.Name, typo);
totalErrors++;
}
}
var fields = t.GetFields ();
foreach (FieldInfo f in fields) {
if (!f.IsPublic && !f.IsFamily)
continue;
if (IsObsolete (f))
continue;
txt = NameCleaner (f.Name);
typo = GetCachedTypo (txt);
if (typo.Length > 0) {
if (!Skip (f, typo)) {
ReportError ("Typo in FIELD name: {0} - {1}, Type: {2}", f.Name, typo, t.Name);
totalErrors++;
}
}
}
var methods = t.GetMethods ();
foreach (MethodInfo m in methods) {
if (!m.IsPublic && !m.IsFamily)
continue;
if (IsObsolete (m))
continue;
txt = NameCleaner (m.Name);
typo = GetCachedTypo (txt);
if (typo.Length > 0) {
if (!Skip (m, typo)) {
ReportError ("Typo in METHOD name: {0} - {1}, Type: {2}", m.Name, typo, t.Name);
totalErrors++;
}
}
#if false
var parameters = m.GetParameters ();
foreach (ParameterInfo p in parameters) {
txt = NameCleaner (p.Name);
typo = GetCachedTypo (txt);
if (typo.Length > 0) {
ReportError ("Typo in PARAMETER Name: {0} - {1}, Method: {2}, Type: {3}", p.Name, typo, m.Name, t.Name);
totalErrors++;
}
}
#endif
}
}
}
#if false
// ease removal of unrequired values (but needs to be checked for every profile)
var unused = allowed.Except (used);
foreach (var typo in unused)
Console.WriteLine ("Unused entry \"{0}\"", typo);
#endif
Assert.AreEqual (0, totalErrors, "Typos!");
}
string GetMessage (object attribute)
{
string message = null;
if (attribute is AdviceAttribute)
message = ((AdviceAttribute) attribute).Message;
if (attribute is ObsoleteAttribute)
message = ((ObsoleteAttribute) attribute).Message;
#if !NET
if (attribute is AvailabilityBaseAttribute)
message = ((AvailabilityBaseAttribute) attribute).Message;
#endif
return message;
}
void AttributesMessageTypoRules (MemberInfo mi, string typeName, ref int totalErrors)
{
if (mi is null)
return;
foreach (object ca in mi.GetCustomAttributes ()) {
string message = GetMessage (ca);
if (message is not null) {
var memberAndTypeFormat = mi.Name == typeName ? "Type: {0}" : "Member name: {1}, Type: {0}";
var memberAndType = string.Format (memberAndTypeFormat, typeName, mi.Name);
// Rule 1: https://github.com/xamarin/xamarin-macios/wiki/BINDINGS#rule-1
// Note: we don't enforce that rule for the Obsolete (not Obsoleted) attribute since the attribute itself doesn't support versions.
if (!(ca is ObsoleteAttribute)) {
var forbiddenOSNames = new [] { "iOS", "watchOS", "tvOS", "macOS" };
if (forbiddenOSNames.Any (s => Regex.IsMatch (message, $"({s} ?)[0-9]+"))) {
ReportError ("[Rule 1] Don't put OS information in attribute's message: \"{0}\" - {1}", message, memberAndType);
totalErrors++;
}
}
// Rule 2: https://github.com/xamarin/xamarin-macios/wiki/BINDINGS#rule-2
if (message.Contains ('`')) {
ReportError ("[Rule 2] Replace grave accent (`) by apostrophe (') in attribute's message: \"{0}\" - {1}", message, memberAndType);
totalErrors++;
}
// Rule 3: https://github.com/xamarin/xamarin-macios/wiki/BINDINGS#rule-3
if (!message.EndsWith (".", StringComparison.Ordinal)) {
if (!allowedRule3.Contains (typeName)) {
ReportError ("[Rule 3] Missing '.' in attribute's message: \"{0}\" - {1}", message, memberAndType);
totalErrors++;
}
}
// Rule 4: https://github.com/xamarin/xamarin-macios/wiki/BINDINGS#rule-4
if (!allowedMemberRule4.Contains (mi.Name)) {
var forbiddenAvailabilityKeywords = new [] { "introduced", "deprecated", "obsolete", "obsoleted" };
if (forbiddenAvailabilityKeywords.Any (s => Regex.IsMatch (message, $"({s})", RegexOptions.IgnoreCase))) {
ReportError ("[Rule 4] Don't use availability keywords in attribute's message: \"{0}\" - {1}", message, memberAndType);
totalErrors++;
}
}
var forbiddensWords = new [] { "OSX", "OS X" };
for (int i = 0; i < forbiddensWords.Length; i++) {
var word = forbiddensWords [i];
if (Regex.IsMatch (message, $"({word})", RegexOptions.IgnoreCase)) {
ReportError ("Don't use {0} in attribute's message: \"{1}\" - {2}", word, message, memberAndType);
totalErrors++;
}
}
}
}
}
Dictionary<string, string> cached_typoes = new Dictionary<string, string> ();
string GetCachedTypo (string txt)
{
string rv;
if (!cached_typoes.TryGetValue (txt, out rv))
cached_typoes [txt] = rv = GetTypo (txt);
return rv;
}
public abstract string GetTypo (string txt);
static StringBuilder clean = new StringBuilder ();
static string NameCleaner (string name)
{
clean.Clear ();
foreach (char c in name) {
if (Char.IsUpper (c)) {
clean.Append (' ').Append (c);
continue;
}
if (Char.IsDigit (c)) {
clean.Append (' ');
continue;
}
switch (c) {
case '<':
case '>':
case '_':
clean.Append (' ');
break;
default:
clean.Append (c);
break;
}
}
return clean.ToString ();
}
bool CheckLibrary (string lib)
{
#if MONOMAC
// on macOS the file should exist on the specified path
// for iOS the simulator paths do not match the strings
switch (lib) {
// location changed in 10.8 but it loads fine (and fixing it breaks on earlier macOS)
case Constants.CFNetworkLibrary:
// location changed in 10.10 but it loads fine (and fixing it breaks on earlier macOS)
case Constants.CoreBluetoothLibrary:
// location changed in 10.11 but it loads fine (and fixing it breaks on earlier macOS)
case Constants.CoreImageLibrary:
break;
default:
if (TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 11, 0)) {
// on macOS 11.0 the frameworks binary files are not present (cache) but can be loaded
if (!Directory.Exists (Path.GetDirectoryName (lib)))
return false;
} else if (!File.Exists (lib))
return false;
break;
}
#endif
var h = IntPtr.Zero;
try {
h = Dlfcn.dlopen (lib, 0);
if (h != IntPtr.Zero)
return true;
#if MONOMAC
// on macOS it might be wrong architecture
// i.e. 64 bits only (thin) libraries running on 32 bits process
if (IntPtr.Size == 4)
return true;
#endif
} finally {
Dlfcn.dlclose (h);
}
return false;
}
protected void AssertMatchingOSVersionAndSdkVersion ()
{
var sdk = new Version (Constants.SdkVersion);
#if MONOMAC
if (!NSProcessInfo.ProcessInfo.IsOperatingSystemAtLeastVersion (new NSOperatingSystemVersion (sdk.Major, sdk.Minor, sdk.Build == -1 ? 0 : sdk.Build)))
#elif __WATCHOS__
if (!WatchKit.WKInterfaceDevice.CurrentDevice.CheckSystemVersion (sdk.Major, sdk.Minor))
#else
if (!UIDevice.CurrentDevice.CheckSystemVersion (sdk.Major, sdk.Minor))
#endif
Assert.Ignore ($"This test only executes using the latest OS version ({sdk.Major}.{sdk.Minor})");
}
[Test]
public void ConstantsCheck ()
{
// The constants are file paths for frameworks / dylibs
// unless the latest OS is used there's likely to be missing ones
// so we run this test only on the latest supported (matching SDK) OS
AssertMatchingOSVersionAndSdkVersion ();
var c = typeof (Constants);
foreach (var fi in c.GetFields ()) {
if (!fi.IsPublic)
continue;
var s = fi.GetValue (null) as string;
switch (fi.Name) {
case "Version":
case "SdkVersion":
Assert.True (Version.TryParse (s, out _), fi.Name);
break;
#if !XAMCORE_5_0
case "AssetsLibraryLibrary":
case "NewsstandKitLibrary": // Removed from iOS, but we have to keep the constant around for binary compatibility.
break;
#endif
#if !NET
#if __TVOS__
case "PassKitLibrary": // not part of tvOS
break;
#endif
case "libcompression": // bad (missing) suffix
Assert.True (CheckLibrary (s), fi.Name);
break;
#endif
case "ChipLibrary": // Chip is removed entirely beginning Xcode 14
if (!TestRuntime.CheckXcodeVersion (14, 0))
if (TestRuntime.IsDevice)
Assert.True (CheckLibrary (s), fi.Name);
break;
#if !__MACOS__
case "CinematicLibrary":
case "ThreadNetworkLibrary":
case "MediaSetupLibrary":
case "MLComputeLibrary":
// Xcode 12 beta 2 does not ship these framework/headers for the simulators
if (TestRuntime.IsDevice)
Assert.True (CheckLibrary (s), fi.Name);
break;
#endif
#if __TVOS__
case "MetalPerformanceShadersLibrary":
case "MetalPerformanceShadersGraphLibrary":
// not supported in tvOS (12.1) simulator so load fails
if (TestRuntime.IsSimulatorOrDesktop)
break;
goto default;
case "PhaseLibrary":
// framework support for tvOS was added in xcode 15
// but not supported on tvOS simulator so load fails
if (TestRuntime.IsSimulatorOrDesktop)
break;
goto default;
#endif
case "MetalFXLibrary":
#if __TVOS__
goto default;
#else
if (TestRuntime.IsSimulatorOrDesktop)
break;
goto default;
#endif
default:
if (fi.Name.EndsWith ("Library", StringComparison.Ordinal)) {
#if __IOS__
if (fi.Name == "CoreNFCLibrary") {
// NFC is currently not available on iPad
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
continue;
// Phone works unless Xcode 12 on simulator
if (TestRuntime.IsSimulatorOrDesktop && TestRuntime.CheckXcodeVersion (12, 0))
continue;
}
#endif
#if __MACOS__
// Only available in macOS 10.15.4+
if (fi.Name == "AutomaticAssessmentConfigurationLibrary" && !TestRuntime.CheckXcodeVersion (11, 4))
continue;
#endif
#if __WATCHOS__
// added with watchOS 4 (mistake)
if (fi.Name == "VisionLibrary")
continue;
#endif
Assert.True (CheckLibrary (s), fi.Name);
} else {
Assert.Fail ($"Unknown '{fi.Name}' field cannot be verified - please fix me!");
}
break;
}
}
}
}
}