This will spot cases like https://github.com/xamarin/xamarin-macios/issues/7959
where a type (static) constructor can fail at runtime, leading to
`TypeLoadException`
Ideally it's covered by it's own tests but it's better covered twice
than never :)
On iOS 64bits [1] simulator we hit some failures [2], later, if the
`.cctor` is executed. It's not a big deal to avoid those types since
we it will be executed on devices later.
[1] API not present on 32bits
[2] Fixing the following triggers similar failures for `DCDevice`
```
ApiClassPtrTest.VerifyClassPtr: class_ptr and RegisterAttribute are different: NFCIso15693CustomCommandConfiguration
Expected: 0
But was: 140735471513712
ApiSelectorTest.StaticMethods: 7 errors found in 2788 static selector validated:
CoreNFC.NFCIso15693ReaderSession : readingAvailable
CoreNFC.NFCNdefMessage : ndefMessageWithData:
CoreNFC.NFCNdefPayload : wellKnownTypeURIPayloadWithString:
CoreNFC.NFCNdefPayload : wellKnownTypeURIPayloadWithURL:
CoreNFC.NFCNdefPayload : wellKnownTypeTextPayloadWithString:locale:
CoreNFC.NFCNdefReaderSession : readingAvailable
CoreNFC.NFCReaderSession : readingAvailable
Expected: 0
But was: 7
```
The order of the check matters, we only skip with a sim && not on
xcode11.
The other whay around will do the wrong short circuit. Since if we are
not on Xcode11 we will always skip, including device, which is not
correct.
Fixes: https://github.com/xamarin/xamarin-macios/issues/6243.
* Add xamarin_os_log function
See the comment in the function for an explanation
of why this wrapper function is required.
* Add Darwin/OSLog.cs
* Add xamarin_os_log to header
This ensures that the symbol will not be subject
to C++ name mangling, therefore breaking mmp.
With this change applied, OSLog works as expected.
* Resolve stylistic PR feedback
* Move OSLog into CoreFoundation namespace
This is where the NativeObject class lives, and it
also feels like a better fit for a low-level API
that is available on non-Mac platforms than the
macOS-only Darwin namespace.
There are a number of namespaces that do not support the API and can be
completly skipped. Also some of the classes in those namspaces are
expensive to create and the test is not providing any useful
information.
Fixes: https://github.com/xamarin/maccore/issues/2038
* [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. Fixesxamarin/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.
Fixes this on macOS 10.9:
1) ApiCtorInitTest.DefaultCtorAllowed (Introspection.MacApiCtorInitTest.ApiCtorInitTest.DefaultCtorAllowed)
1 potential errors found in 860 default ctor validated:
CoreImage.CIMaskedVariableBlur : Handle
Expected: 0
But was: 1
at Introspection.ApiCtorInitTest.DefaultCtorAllowed () [0x0019b] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/introspection/ApiCtorInitTest.cs:295
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
2) ApiCoreImageFiltersTest.Keys (Introspection.MacCoreImageFiltersTest.ApiCoreImageFiltersTest.Keys)
System.ArgumentNullException : Value cannot be null.
Parameter name: array
at System.Array.IndexOf[T] (T[] array, T value) [0x0000e] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/corert/src/System.Private.CoreLib/src/System/Array.cs:666
at Introspection.ApiCoreImageFiltersTest.Keys () [0x002b7] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/introspection/ApiCoreImageFiltersTest.cs:445
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
3) ApiCoreImageFiltersTest.Protocols (Introspection.MacCoreImageFiltersTest.ApiCoreImageFiltersTest.Protocols)
1 potential errors found:
Managed CIMaskedVariableBlur was not part of the native filter list
Expected: 0
But was: 1
at Introspection.ApiCoreImageFiltersTest.Protocols () [0x0104e] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/introspection/ApiCoreImageFiltersTest.cs:370
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
And this on macOS 10.10:
1) ApiCoreImageFiltersTest.Keys (Introspection.MacCoreImageFiltersTest.ApiCoreImageFiltersTest.Keys)
1 potential errors found:
CICode128BarcodeGenerator: Property `BarcodeHeight` mapped to key `inputBarcodeHeight` is not part of `InputKeys`.
Expected: 0
But was: 1
at Introspection.ApiCoreImageFiltersTest.Keys () [0x006b1] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/introspection/ApiCoreImageFiltersTest.cs:524
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
2) ApiCoreImageFiltersTest.Protocols (Introspection.MacCoreImageFiltersTest.ApiCoreImageFiltersTest.Protocols)
1 potential errors found:
CICode128BarcodeGenerator: Property `BarcodeHeight` mapped to key `inputBarcodeHeight` is not part of `InputKeys`.
Expected: 0
But was: 1
at Introspection.ApiCoreImageFiltersTest.Protocols () [0x0104e] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/introspection/ApiCoreImageFiltersTest.cs:370
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
And this on macOS 11.11:
1) ApiCoreImageFiltersTest.Keys (Introspection.MacCoreImageFiltersTest.ApiCoreImageFiltersTest.Keys)
2 potential errors found:
CICode128BarcodeGenerator: Property `BarcodeHeight` mapped to key `inputBarcodeHeight` is not part of `InputKeys`.
CIGaussianBlur: Output Key `outputImageV1` is NOT mapped to a `OutputImageV1` property.
Expected: 0
But was: 2
at Introspection.ApiCoreImageFiltersTest.Keys () [0x006b1] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/introspection/ApiCoreImageFiltersTest.cs:524
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
2) ApiCoreImageFiltersTest.Protocols (Introspection.MacCoreImageFiltersTest.ApiCoreImageFiltersTest.Protocols)
2 potential errors found:
CICode128BarcodeGenerator: Property `BarcodeHeight` mapped to key `inputBarcodeHeight` is not part of `InputKeys`.
CIGaussianBlur: Output Key `outputImageV1` is NOT mapped to a `OutputImageV1` property.
Expected: 0
But was: 2
at Introspection.ApiCoreImageFiltersTest.Protocols () [0x0104e] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/introspection/ApiCoreImageFiltersTest.cs:370
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
* [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
* [tests] Fix introspection and xammac tests on Catalina. (#7200)
* [tests] Adjust NaturalLanguage.EmbeddingTest to cope with non-existent embeddings. Fixesxamarin/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.
Apple decided to expose most (but not all) `CIFilter` using protocols
(instead of weakly named dictionaries). Most of this maps well with
our strong bindings but there are cases where we:
* missing some properties (easy, there were added); or
* used a different types [1] and that requires new members / obsoletion
A few other API were also added in Xcode 11 (nothing in 11.1 or 11.2) and
included in this PR.
New introspection tests were also added to minimize the risk that
the API and generator changes produced incorrect code. This lead
to the finding of some missing API (in particular `Output*` properties)
that were added.
[1] Often ours are better (using `float` for a `bool` value is not
optimal) but we do not have `[BindAs]` for protocols :( to _fix_ them
Note: this replace draft PR https://github.com/xamarin/xamarin-macios/pull/7120 but it's has quite a bit of changes in filter generation (inlining protocols) and that affected bindings too.
We ship a default, pre-built, simlauncher for iOS simulator applications.
This speeds up compilation for the default (non linked) simulator builds
quite a lot (no call to `clang` is needed). However it force us to keep
track of frameworks manually - `mtouch` can track them but requires
calling clang/ld to finish things up (killing the optimization).
It's easy to forget some (new) frameworks since they can be loaded
dynamically (on demand) _most_ of the time. Sadly there are a few cases
where doing so cause (hard to diagnose) problems - so we can't depend
on them being loaded, correctly for us.
The new test case loads the `otool -L` output (make when we build
simlauncher[32|64]-sgen) and compares it with mtouch's GetFramework
logic *and* with our namespaces (which is pretty close, with a few
exceptions, to the framework names). This will make it harder to
forget [weak] frameworks when adding new bindings :)
Fixes https://github.com/xamarin/xamarin-macios/issues/6951
Xcode 11 doesn't support anything below iOS 7.0 (the linker will automatically
change the deployment target to 7.0), so we need to drop support as well
(since our native bits will be targetting iOS 7.0, and we can't change that).
https://github.com/xamarin/xamarin-macios/issues/6213
Xcode 10.3 was released over the summer with a very small subset
of the (already out) Xcode 11 betas API.
This PR fix some availability attributes and also ensure we can
run introspection tests successfully on an iOS 12.4 device.
* [WatchKit] Remove this framework for iOS while keeping backwards compatibility. Fixes#6492.
* Copy all generated sources and modify them to throw PlatformNotSupported exceptions.
* Adjust some existing source code to also throw PlatformNotSupported exceptions.
* Sprinkle Obsolete attributes generously.
* Stop generating code for the WatchKit framework for iOS.
Fixes https://github.com/xamarin/xamarin-macios/issues/6492.
* [introspection] Adjust test.
* [mtouch] Don't link with WatchKit, and show a warning if we detect code that want to use WatchKit.
* [xtro] Remove WatchKit for iOS.
* [introspection] Don't check obsoleted NSString fields for null.
There's probably a reason the field was obsoleted.
* [introspection] Add exception for the WatchKit framework.
* [xtro] Ignore obsolete enums.
There's probably a reason they're obsoleted.
In particular it solves a confusion between WKWebKit.WKErrorCode and
WatchKit.WKErrorCode: for iOS, the latter is obsoleted, and this way we always
process the former instead.
* [mtouch] Adjust wording for MT4178 to be more accurate.
* [WatchKit] Make more API obsolete/hidden.
Two classes managed to slip past the first time.
* [tests] Adjust test after WatchKit removal.
Moved some code from uikit.cs since the type moved a while ago. That
ease code sharing with macOS (XM) but it stays into the UIKit namespace
(for XI) until `XAMCORE_4_0` to ensure binary compatibility.
* healthkit b1-b3 updates
* fixes for first round of comments
* remove whitespace noise
* move hkcategorytype enums
* update mono-touch tests, remove [designatedinitializer] attr
* alex nit fixes
* fix formatting for [Deprecated]
* update mono-touch tests with even more enums
* InsertQuantity -> Insert
* remove references to xcode13, which does not exist
* add HKCharacteristicTypeIdentifierActivityMoveMode to .ignore files