If forcing a managed type for a particular native handle, we must ensure we're
always successful.
This means creating another managed instance even if there already is an
existing instance for the native handle. This is not optimal, but the
alternative is worse: some functionality can be completely broken otherwise
(such as NSSavePanel⁄NSOpenPanel may stop working).
If creating multiple managed instances for the same native handle ends up
being too problematic, we'll probably have to add full support for this
scenario (see #7442).
Fixes https://github.com/xamarin/xamarin-macios/issues/7441.
If forcing a managed type for a particular native handle, we must ensure we're
always successful.
This means creating another managed instance even if there already is an
existing instance for the native handle. This is not optimal, but the
alternative is worse: some functionality can be completely broken otherwise
(such as NSSavePanel⁄NSOpenPanel may stop working).
If creating multiple managed instances for the same native handle ends up
being too problematic, we'll probably have to add full support for this
scenario (see #7442).
Fixes https://github.com/xamarin/xamarin-macios/issues/7441.
* [CoreFoundation] CFBundle.GetAll better thread safe.
The initial solution fixed the rance condition in which the index
changed, but that did not guarantee that we would get the correct
bundles. We now clone the CFArray (which also clones the callbacks set
to the array) and iterate over it to make sure Apple does not do evil
tings while we are iteraing.
Better Fixes: https://github.com/xamarin/maccore/issues/940
* [CoreFoundation] Add Clone method for CFArray. (#7403)
When working on https://github.com/xamarin/maccore/issues/940 we noticed
that clone the array would be a better approach.
The CFArrayCreateCopy add some nice things:
* The pointer values from theArray are copied into the new array.
* The values are also retained by the new array.
* The count of the new array is the same as theArray
* The new array uses the same callbacks as theArray. [IMPORTANT]
Whith this in, we can have a better fix for https://github.com/xamarin/maccore/issues/940
The initial solution fixed the rance condition in which the index
changed, but that did not guarantee that we would get the correct
bundles. We now clone the CFArray (which also clones the callbacks set
to the array) and iterate over it to make sure Apple does not do evil
tings while we are iteraing.
Better Fixes: https://github.com/xamarin/maccore/issues/940
When working on https://github.com/xamarin/maccore/issues/940 we noticed
that clone the array would be a better approach.
The CFArrayCreateCopy add some nice things:
* The pointer values from theArray are copied into the new array.
* The values are also retained by the new array.
* The count of the new array is the same as theArray
* The new array uses the same callbacks as theArray. [IMPORTANT]
Whith this in, we can have a better fix for https://github.com/xamarin/maccore/issues/940
The initial solution fixed the rance condition in which the index
changed, but that did not guarantee that we would get the correct
bundles. We now clone the CFArray (which also clones the callbacks set
to the array) and iterate over it to make sure Apple does not do evil
tings while we are iteraing.
Better Fixes: https://github.com/xamarin/maccore/issues/940
When working on https://github.com/xamarin/maccore/issues/940 we noticed
that clone the array would be a better approach.
The CFArrayCreateCopy add some nice things:
* The pointer values from theArray are copied into the new array.
* The values are also retained by the new array.
* The count of the new array is the same as theArray
* The new array uses the same callbacks as theArray. [IMPORTANT]
Whith this in, we can have a better fix for https://github.com/xamarin/maccore/issues/940
CFBundleGetAllBundles as per Apple docs is not thread safe, this means
that when we loop over the bundles, and use a property, the value is
updated by a different thread. This means that in some weird cases we
get an IndexOutOfBounds exception. We now store the count and use it in
the loop.
Fixes: https://github.com/xamarin/maccore/issues/940
CFBundleGetAllBundles as per Apple docs is not thread safe, this means
that when we loop over the bundles, and use a property, the value is
updated by a different thread. This means that in some weird cases we
get an IndexOutOfBounds exception. We now store the count and use it in
the loop.
Fixes: https://github.com/xamarin/maccore/issues/940
Uncommented the sources and update some mistakes after following the
sample provided by Apple. Initially tests were going to be added but
they resulted to be to flacky and would make the CI red too often to be
adding value.
Porting the sample will ensure that it works are the bindings are not
broken.
* [Runtime] Enable the -Wshorten-64-to-32 flag and fix all warnings.
We want to enable the -Wconversion but that will raise too many warning
for a single commit. We are enabiling one by one the flags included in
-Wconversion so that we have smaller diffs.
-Wshorten-64-to-32 adds warnings when there is a implicit conversion that
loses integer precision. We are moving all the 32 to 64 conversions to
use 64. Expecially since most of the code changed is related with sizes,
legths and params counts that are never going to be negative.
Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
This is already done by the generated code, as seen below.
```csharp
selWindowWithWindowNumber_Handle = Selector.GetHandle ("windowWithWindowNumber:");
selWindowsHandle = Selector.GetHandle ("windows");
selWindowsMenuHandle = Selector.GetHandle ("windowsMenu");
class_ptr = Class.GetHandle ("NSApplication");
class_ptr = Class.GetHandle ("NSApplication");
}
```
With this change, we've also removed the static constructor, therefore all the fields are going to be initialized when they are used, as opposed to being forcefully loaded on the first access. This may improve startup times
We have only encountered a case in which we had to add a nested
class/enum as the return type of a property. This fix ensures that we
can work with 1 level nested classes. A more general situation with
nested/nested/nested/.. classes is not taken into account because:
1. Would complicate too much the code.
2. Is fixing problems we do not have AFAIK.
So I'm keeping the fix simple, as I said, we have never faced anything
deeper than one level.
and by friends I mean `mmp` and `btouch`
What does this do ?
1. Assume that output of `mtouch` (and other similar tools) is **always** of high importance. Why ?
- If not then it's not saved in the binary log (even if visible on the console/text logs).
- The logging of `mtouch` (and friends) is dynamic, based on a supplied verbosity level.
- If a verbosity level _anywhere_ then it's a clear sign that the developer wants that extra output (and that includes binary logs).
2. Assume the _global_ verbosity of `msbuild` from the console is just as valid/useful than the one from VSfM.
- CI/bots produce logs and they should be useful to diagnose build issues.
- Setting verbosity in several places is error-prone, which delay investigations and results.
- Running the same project, with the same `msbuild` verbosity, should be identical between IDE and console.
What does that mean ?
Using `msbuild /v:diag /bl:out.binlog` you get a small(er) binary log that has everything[1] you need to diagnose a Xamarin.iOS (or Mac) build. It's also identical to the output what VSfM produce (for the same `msbuild` verbosity level).
[1] we might need to review what we log if we're missing interesting stuff
References:
https://github.com/xamarin/xamarin-macios/issues/7035
* 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.
The block/delegate passed to NWTxtRecord.Apply is supposed to return a bool.
Not returning anything ends up with random behavior, which causes a test
failure on Catalina:
3) TestApply (MonoTouchFixtures.Network.NWTxtRecordTest.TestApply)
keycount
Expected: 4
But was: 1
at MonoTouchFixtures.Network.NWTxtRecordTest.TestApply () [0x000a3] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/monotouch-test/Network/NWTxtRecordTest.cs:134
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-pr-builder/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
I've fixed the existing API to return 'true' always in the block callback, to
get consistent behavior, and in addition I've added a new overload that takes
a delegate that returns a bool, which allows the consumer of the API to decide
what to return.
Fixes https://github.com/xamarin/maccore/issues/2036.
* [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.
* Add bindings for NSXpcConnection and related types
* Re-add accidentally deleted file
* Typo fix
* Add NSXpcInterface.CreateForType()
* Add MethodInfo-taking overloads to NSXpcInterface
* Add null check
* Mark methods with wrappers as internal
Also fixed a formatting bug that I didn't catch earlier.
* Change NSXPCProxyCreating methods to be strongly typed
I got rid of the NSXpcProxyCreating interface in this change,
because its only user was NSXpcConnection, and I needed to
inline the protocol methods into the class definition so I
could mark them as [Internal].
* Add missing casts
* Add NSXpcConnectionOptions enum
* Convert NSXpcConnection constructor to use new enum
* Remove now-unneeded manual constructor
* Fix bgen warning
* Typo fix
* Fix selector
* Remove incorrect use of BindAsAttribute
Per the docs, this only works for enums backed
by NSNumber and NSValue, not for enums
passed directly as integers.
* Fix duplicated selector errors
* Throw ArgumentException instead of InvalidOperationException
* Extend AppExtension targets to produce XPC services
Rather than create an entirely new set of targets
(that would require VS and VSMac updates to properly
consume), I have decided to use the existing AppExtension
build targets to produce XPC services as well. All the
user must do is set the $(IsXPCService) property to true in
their project file, and the targets will do The Right Thing™.
Note that this support is Mac-only for now; I may need a bit
of help adjusting them to work on for iOS/watchOS/tvOS, as I
am not as familiar with those platforms.
* Copy XPC service bundles into the correct location
* Move IsXPCService property definition to props file
* Don't pass /extension to mmp for XPC service targets
This would cause the XPC service binary to
be linked incorrectly.
* Add NSXpcConnection/NSXpcInterface.cs files to the build
* Fix build
* Fix build
* Add required type parameter requirements
* Fix type parameter requirements
* Fix return type
* Fix return type of NSXpcInterface.CreateForProtocol ()
* Take ownership of the returned object types
* Adjust XPC service mmp invocation
I need to link the XPC service bundle as if it is an app extension, but
I must not use xamarin_mac_extension_main. I added a new flag to make
this possible.
* Change mmp to correctly construct XPC service bundle
* Set the MonoBundleExecutable Info.plist key for XPC services
* Use the runtime to get the protocol
* Make NSXpcInterface.CreateForProtocol() public
The static registrar must be used for Cocoa to accept the protocol
as a valid XPC interface, but that then seems to break resolving
the protocol from the type. I must therefore hard-code the protocol
name in my code, and that requires I make this constructor public.
* Add XpcInterfaceAttribute
See the doc comment in XpcInterfaceAttribute.cs for why
this type is required. The referenced mmp optimizations
will be added in future commits.
* Add XpcInterfaceAttribute to generator build
* Add support for XpcInterfaceAttribute to the generator
* Force static generation of protocols decorated with XpcInterfaceAttribute
* Change how static registrar translates block parameters
Previously, they would always be marshalled as "id".
This would throw off the XPC subsystem, which parses
the block signature to determine the communication
protocol.
* Undo whitespace noise
* Remove unneeded casts
* Add trailing comma
* Use HasAttribute instead of GetCustomAttribute
* Fix style issues
* Bind NSXpcConnection.auditSessionIdentifier
* Address naming feedback
* Make Get/SetAllowedClasses public
IMHO, passing the selector as a string is just as
usable as passing a MethodInfo, and is also less
verbose if you copy/paste the selector string
from the ExportAttribute. There is no reason why
we cannot have both overloads be public.
* Update overload names to match
* Update more overload names to match
* Make mmp --xpc imply --extension
* Reformat if statement
* Fix build
* Conditionalize creation of PlugIns and XPCServices directories
* Add AutoGeneratedName
Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
* Get rid of ProtocolizeAttribute
* Update availability attributes to please xharness
I actually think xharness is wrong here, since the
NSXPCConnection header lists these types as being
available starting in macOS 10.8.
* Update sharpie ignore files to reflect changes
This should fix the xtro-sharpie test failures CI has been reporting.
* Fix MM4105 error generation
* Adjust error message in test to match mmp
I had to change the error text slightly, because the type of the parameter
cannot be determined where the error is thrown anymore. However, the newer
exception message IMO is just as clear.
* Make exception message match test exactly
* Remove outdated copyright header text
* Remove more outdated copyright header text
* Revert changes to MM4105 error generation
I have a more elegant way of fixing this test now.
* Return "id" if Invoke method cannot be found
This fixes the MM4105 error unit test,
without requiring modification to that test.
* Remove redundant availability attributes
* Add DesignatedInitializerAttribute
* Re-add required code to macOS-Foundation.ignore
* Put DesignatedInitializer on the right constructor
* Update xtro-sharpie ignore files
Providing callbacks with DispatchData and Int + length is not nice for
the non advance users. Added set of methods that will use callbacks that
will provide the users with ReadOnlySpan, which is nicer and makes it
work with the API easier.
Also, the change allows users to avoid unsafe code.
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
* [Networking] Add a generic method to get the metadata from the context.
There are different types of NWProtocolMetadata, being one of them (to be
added later) the NWFramerMessage that exposes extra methods.
With the current API we can only do:
```
var metadata = context.GetProtocolMetadata (protocol.ProtocolDefinition);
```
Which just returns the generic object, and if the protocol definition is
from a NWFramer, we want to be able to get the correct metadata object.
With the provided method you can do:
```
var metadata = context.GetProtocolMetadata<NWFramerMessage> (protocol.ProtocolDefinition);
```
Which allows the user to specify the expected metadata type from a given
protocol definition.
* [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.
* [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.
Kept the API as it was but added a new handler that will be called when
all the changes from the browser have been done. The old Set* method
could be deleted in a future release and just expose the property.
* Implement a different escaping/quoting algorithm for arguments to System.Diagnostics.Process.
mono changed how quotes should be escaped when passed to
System.Diagnostic.Process, so we need to change accordingly.
The main difference is that single quotes don't have to be escaped anymore.
This solves problems like this:
System.ComponentModel.Win32Exception : ApplicationName='nuget', CommandLine='restore '/Users/vsts/agent/2.158.0/work/1/s/tests/sampletester/bin/Debug/repositories/ios-samples/WorkingWithTables/Part 3 - Customizing a Table\'s appearance/3 - CellCustomTable/CellCustomTable.sln' -Verbosity detailed -SolutionDir '/Users/vsts/agent/2.158.0/work/1/s/tests/sampletester/bin/Debug/repositories/ios-samples/WorkingWithTables/Part 3 - Customizing a Table\'s appearance/3 - CellCustomTable'', CurrentDirectory='/Users/vsts/agent/2.158.0/work/1/s/tests/sampletester/bin/Debug/repositories', Native error= Cannot find the specified file
at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0029f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-08/external/bockbuild/builds/mono-x64/mcs/class/System/System.Diagnostics/Process.cs:778
ref: https://github.com/mono/mono/pull/15047
* Rework process arguments to pass arrays/lists around instead of quoted strings.
And then only convert to a string at the very end when we create the Process
instance.
In the future there will be a ProcessStartInfo.ArgumentList property we can
use to give the original array/list of arguments directly to the BCL so that
we can avoid quoting at all. These changes gets us almost all the way there
already (except that the ArgumentList property isn't available quite yet).
We also have to bump to target framework version v4.7.2 from v4.5 in several
places because of 'Array.Empty<T> ()' which is now used in more places.
* Parse linker flags from LinkWith attributes.
* [sampletester] Bump to v4.7.2 for Array.Empty<T> ().
* Fix typo.
* Rename GetVerbosity -> AddVerbosity.
* Remove unnecessary string interpolation.
* Remove unused variable.
* [mtouch] Simplify code a bit.
* Use implicitly typed arrays.
* [Foundation] Remove a possible race condition when intereacting with the notification centre.
Although it looked that it was not possible, due to the fact that the
RemoveObserversFromList oes lock on the list of observers, we have
threads that are stepping on each other when the list is cleaned up.
Adding a lock around the AddObserver and RemoveObserver will ensure that
the handler does not call the removal more than once with an object that
was already removed.
Fixes https://github.com/xamarin/xamarin-macios/issues/6387
* Move the removal of the notification to inside the lock in the dispose method.
* Better locking as per reviews.
It does not look like an issue, at least today, since it's always set to
`false` but better fix it before it becomes an hard to debug issue
```
$ git grep "IsConstructor = "
src/ObjCRuntime/Registrar.cs: IsConstructor = false,
src/ObjCRuntime/Registrar.cs: IsConstructor = false,
src/ObjCRuntime/Registrar.cs: IsConstructor = false,
```
* [AppKit] Add missing Accessibility protocols.
This commit adds a few protocols that were missing. It is interesting to
mention that there are two of the protocols that are decorated with
NS_PROTOCOL_REQUIRES_EXPLICIT_IMPLEMENTATION, as per Apple documentation
this means that:
'Unlike normal protocols, when you adopt one of the role-specific protocols,
Xcode may ask you to reimplement methods that have already been implemented
by one of your ancestors.
In order to ensure that your control returns accurate and useful information,
some methods are tagged with the NS_PROTOCOL_REQUIRES_EXPLICIT_IMPLEMENTATION
attribute. For these methods, you need to override your superclass’s
implementation with your own.
'
In this case, we need to add the methods from all the parent classes and
set them to be [Abstract] since they are required. Not all methods have
to be added ONLY the required ones.
fixes: https://github.com/xamarin/xamarin-macios/issues/7079
* Remove the new methods.
Types that are new in 64bits only OS are generated differently on 32bits
bindings. They mainly throw a `PlatformNotSupportedException` so it's
easier to diagnose (than a crash) what's happening at runtime.
This works well in all cases except one. When a new type, let's say
`UIMenuElement` is added **and** serves as a new base type for existing
types.
`UIKeyCommand` (iOS 7) -> `UICommand` (iOS 13)-> `UIMenuElement` (iOS 13)
This is _correct_ as new base types can be added (in ObjC and C#).
However the generated code for the constructors of `UICommand` and
`UIMenuElement` would be throwing a `PlatformNotSupportedException`
which breaks the `UIKeyCommand` on 32 bits devices.
We fixed this in a few places by tweaking the availability attribute
but that requires spotting the new base type while doing bindings and
that is error prone [1][2].
This PR simply does let the `protected` constructor, using when chaining,
be generated normally. It's simpler and will cover all the cases (without
requiring hacks in the availability of those types)
[1] https://github.com/xamarin/xamarin-macios/issues/7083
[2] https://github.com/xamarin/xamarin-macios/issues/7084
Types that are new in 64bits only OS are generated differently on 32bits
bindings. They mainly throw a `PlatformNotSupportedException` so it's
easier to diagnose (than a crash) what's happening at runtime.
This works well in all cases except one. When a new type, let's say
`UIMenuElement` is added **and** serves as a new base type for existing
types.
`UIKeyCommand` (iOS 7) -> `UICommand` (iOS 13)-> `UIMenuElement` (iOS 13)
This is _correct_ as new base types can be added (in ObjC and C#).
However the generated code for the constructors of `UICommand` and
`UIMenuElement` would be throwing a `PlatformNotSupportedException`
which breaks the `UIKeyCommand` on 32 bits devices.
We fixed this in a few places by tweaking the availability attribute
but that requires spotting the new base type while doing bindings and
that is error prone [1][2].
This PR simply does let the `protected` constructor, using when chaining,
be generated normally. It's simpler and will cover all the cases (without
requiring hacks in the availability of those types)
[1] https://github.com/xamarin/xamarin-macios/issues/7083
[2] https://github.com/xamarin/xamarin-macios/issues/7084
Add new overloads so we can skip `String.Format` calls when relaying
messages without any arguments. Solve cases like
```
error BI0000: Unexpected error - Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new
System.FormatException: Input string was not in a correct format.
at System.Text.StringBuilder.AppendFormatHelper (System.IFormatProvider provider, System.String format, System.ParamsArray args) [0x000b2] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-06/external/bockbuild/builds/mono-x64/external/corefx/src/Common/src/CoreLib/System/Text/StringBuilder.cs:1445
...
```
because we failed compilation due to an (hidden) syntax error like:
```
foundation.cs(3627,3): error CS1519: Invalid token '{' in class, struct, or interface member declaration
```
where the `{` character is causing the `FormatException` inside the
generator sources.
This is now more properly reported as
```
error BI0002: bgen: Could not compile the API bindings.
foundation.cs(3627,3): error CS1519: Invalid token '{' in class, struct, or interface member declaration
```
This should let us provide a nicer API for the GM change about
`CBManager authorization` moving from an instance to a static
property (in all but iOS 13.0 / watchOS 6.0)
With xcode11 GM the tvOS and macOS headers drifted from the iOS ones.
It's not clear if they should be different (hopefully not) or if iOS
has been forgotten...
While waiting for Apple's feedback (and the avoid breaking changes)
the new (conflicting) enum values are not included.
Internal reference: https://github.com/xamarin/maccore/issues/1960
For some reason (likely to be added back later ?) Xcode 11 GM removed
most of new macOS 10.15 API for FileProvider.
So instead of deleting stuff this uses a lot of `[NoMac]` even if some
API are actually not part of any platform anymore, e.g. you can see the
following line in the GM headers
```
API_UNAVAILABLE(watchos, tvos) API_UNAVAILABLE(ios, macos)
```
* [registrar] Report a warning when the registrar export an abstract INativeObject type to Objective-C.
Exporting abstract types to Objective-C can lead to problems when at runtime
we're asked to create an instance of such a type (which we can't), so warn
when this happens.
This would have caught #6655, and the problems explained in #4969 as well.
Since this may trigger for code that's currently working fine, I'm making it a
warning instead of an error (which means adding some extra code to be able to
easily report warnings from the generator code).
* Don't assume a TypeReference can be successfully resolved every time.
CoreAudioTypes is _new_ but it's just some stuff that moved around,
however it now shows up separately in our API diff (and was quite
large because of the removal/addition caused by moving headers)
Issue was reponed because users had a valid reason to want to bypass
this security check. The HttpClient should be able to work in a
background task. So we now provide a way for users to explicitly ignore
the check.
Fixes: https://github.com/xamarin/xamarin-macios/issues/6443
* [foundation] Expose AllowsCellularAccess on NSUrlSessionHandler (#6059)
This property was always set to `true` but it can be useful to turn it
off (and that was not easy with the existing implementation)
* [Foundation] Ensure that we allow celullar data by default until the user says otherwise. #6762
The default value in the NSUrlSession is to allow cellular data. This
small change closes the issue, since users will not have an unexpected
result.
Later we need to provide a proper fix to allow the property to be
exposed AND used the value of the session.
Fixes: https://github.com/xamarin/xamarin-macios/issues/6762
* [Foundation] Ensure that we allow celullar data by default until the user says otherwise. #6762
The default value in the NSUrlSession is to allow cellular data. This
small change closes the issue, since users will not have an unexpected
result.
Later we need to provide a proper fix to allow the property to be
exposed AND used the value of the session.
Fixes: https://github.com/xamarin/xamarin-macios/issues/6762
AVCaptureSynchronizedDepthData's init method is not available, which means we
should make the corresponding binding obsolete. We've already removed the
bound constructor, because it made introspection crash, this is just the
second part.
Make CNFetchResult generic (which it is in Objective-C), and add a generic
version of NSEnumerator (which Objective-C also has), so that we can bind two
API in CNContactStore that uses generic versions of those types.
Fixes https://github.com/xamarin/xamarin-macios/issues/6561.
Support for `NSValue`/`CGAffineTransform` exists in iOS/tvOS/watchOS,
from UIKit, but not for macOS. However this will be required for the
new protocols inside CoreImage.
Also add an overload for `StoreValueAtAddress` since the original
one was deprecated but we did not provide the new alternative to
update the code.
Ensure that we do lock when we are trying to remove the notification obj from the notification center so that another thread does not try to remove a null obj.
It's now possible to have an empty smart `enum` but this was generating
an empty switch statement that `csc` would warn us about, e.g.
```
build/{profile}/ASAuthorizationProviderAuthorizationOperation.g.cs(64,24): warning CS1522: Empty switch block
```
This fix the generation to skip the `switch` generation when no fields
are present in the enum.
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
* [Foundation] Ensure that the collection is not modified during the loop. #6704
Collections should not be modified during the loop, this is bad
practice and was a side effect of the TrySetCanceled. Is better to
create a temp collection with all the sources and cancel each of them.
Fixes https://github.com/xamarin/xamarin-macios/issues/6704
* [Foundation] Ensure that the collection is not modified during the loop. #6704
Collections should not be modified during the loop, this is bad
practice and was a side effect of the TrySetCanceled. Is better to
create a temp collection with all the sources and cancel each of them.
Fixes https://github.com/xamarin/xamarin-macios/issues/6704
The generator will create special *Appearance types (these are nested
classes). If we've bound a type with the same *Appearance name, we can end up
in a situation where the csc compiler uses the the type we don't want due to
C#'s resolution rules - this happens if the bound *Appearance type is
referenced from the containing type of the special *Appearance type. So always
reference the bound *Appearance types using global:: syntax.
Fixes https://github.com/xamarin/xamarin-macios/issues/6834.
* [registrar] Fix verification of generic parameters to accept unrelated generic types. Fixes#6687.
When we export generic classes to Objective-C, we verify that any generic
parameters are constrained so that we know how to handle them.
Example:
class MyObj<T> : NSObject where T: NSObject
{
[Export ("foo:")]
public void Foo (T obj);
}
in this case we verify that the parameter T is constrained to NSObject, so
that we can treat the argument like an NSObject.
The problem was when the function contained a generic type which was not
related to T:
class MyObj<T> : NSObject where T: NSObject
{
[Export ("foo:")]
public void Foo (Action<int> obj);
}
in which case the same logic would kick in and reject the Action<int> type
since it's not related to NSObject (no generic arguments could be found, and
the default response was 'not valid').
So I've changed the default response for generic types that are unrelated to
the generic parameter we're verifying to accept such types.
Fixes https://github.com/xamarin/xamarin-macios/issues/6687.
* No need to use a UIViewController as the super class, NSObject works just fine for this test.
Fixes the test build on macOS.
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.
New framework - but it includes some of iOS API that were previously in
QuickLook.framework. Types were moved but remains in the old namespace
until `XAMCORE_4_0` is defined.
`gamePlayerID` and `teamPlayerID` are decorated as `[iOS (12,4)]...` since
the headers mention so in both Xcode 11 betas and the recent 10.3 (stable)
https://github.com/xamarin/xamarin-macios/wiki/GameKit-iOS-xcode103-final
The `enum GKError` has been unified (at some point) so it was simplified.
Mark the `iconWithContact:` API as not available with Catalyst
Note that the category `UIApplicationShortcutIcon (ContactsUI)` was
inlined in UIKit's `UIApplicationShortcutIcon` so only that file needs
to be updated.
* [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.
Also introduce `PlatformName.MacCatalyst` while keeping the old
`UIKitForMac`, with the same value, until we can clean up existing
bindings globally (and without too much conflicts).
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.
No change in beta 2 to 5
* Run EmbeddingTest.Vector test on iOS and macOS only
reference: rdar 44948030
> Engineering has the following feedback for you: The tagging
> depends on the NLP assets being present on the device. The
> assets get downloaded through OTA. OTA download for NLP assets
> does not exist on watchOS and tvOS currently…only on iOS and
> macOS. It is conceivable that the assets got downloaded when you
> were on WiFi at a later point. So, the tagging should work.
The dispose of `nslang` was happening outside of the check if `nslang` is null. This was causing a crash when trying to recognise a string that contains just one number.
The dispose of `nslang` was happening outside of the check if `nslang` is null. This was causing a crash when trying to recognise a string that contains just one number.
Fixes: https://github.com/xamarin/xamarin-macios/issues/6688
- Fix deprecation messages to point to an existing API;
- Add setters for `Value` properties instead of adding `SetValue` methods;
- Removing some `[TV (13,0)]` when the API was already available in previous tvOS versions. It's implied that type that existed in tvOS 9.0 (the first version) do not have (nor need) availability attributes. Decorating them as `13,0` sends an incorrect message to developers (since the API have been available for a while)
- Adding some `[TV (13,0)]` when a new API only mention iOS
reference: https://github.com/xamarin/xamarin-macios/pull/6589
* adding GameController, issue including GCMotion.cs
* pushing temp fix by removing struct headers
* removed few introduced statements
* adding my name to top of file
* fixed review issues
* fixing issues cont
* forgot the enums
* fixing format of Deprecated messages
* missed a couple onlyOn64
* adding attributes
* removing additions to existing struct
* changed deprecated messages and selector names
* removing extra whitespace
* Added the struct in the new order from apple
* addressed Rolfs changes
* removed a diff change
* 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
A change in the linker made a potential problem show up as a registrar error
instead of a runtime exception.
The linker became smarter in d16-2, and will now remove interface
implementations in certain cases. In particular, the linker will remove
interface implementations for a type that is never instantiated (which means
there will never be any instances of that type, which means the interface
won't be needed).
The ABRecord was abstract, and as such there will never be any ABRecord
instances. If none of ABRecord's subclasses are used in the app, there won't
be instances of ABRecord subclasses either.
This meant the linker removed all of ABRecord's interfaces, including
INativeObject.
We have API that uses ABRecord in the signature. The registrar needs to know
if a particular type is an INativeObject, which is determined by checking if
the type implements the INativeObject interface. Since the INativeObject
interface implementation was removed, the registrar determined that the
ABRecord type in the signature is invalid, and showed an error:
Error MT4136: The registrar cannot marshal the parameter type 'AddressBook.ABRecord' of the parameter 'address' in the method 'PassKit.PKPaymentAuthorizationViewController/_PKPaymentAuthorizationViewControllerDelegate.DidSelectShippingAddress(PassKit.PKPaymentAuthorizationViewController,AddressBook.ABRecord,PassKit.PKPaymentShippingAddressSelected)
The actual problem is not the linker change, but the fact that a signature
uses an abstract type. At runtime, this will cause problems if we ever need to
instantiate such a managed type: we can't. This is generally not a problem for
NSObject subclasses, because we can determine the runtime type of the object,
and that's usually [1] some other, non-abstract type. However, for
INativeObjects, we can't find a better type at runtime (because we can't
determine the runtime type of the object), so we're left with trying to
instantiate the exact type in the signature. If this is an abstract type,
things will go badly.
So make ABRecord non-abstract.
Fixes https://github.com/xamarin/xamarin-macios/issues/6654.
[1] Usually, but not always, as history has shown. See also https://github.com/xamarin/xamarin-macios/issues/4969.
A change in the linker made a potential problem show up as a registrar error
instead of a runtime exception.
The linker became smarter in d16-2, and will now remove interface
implementations in certain cases. In particular, the linker will remove
interface implementations for a type that is never instantiated (which means
there will never be any instances of that type, which means the interface
won't be needed).
The ABRecord was abstract, and as such there will never be any ABRecord
instances. If none of ABRecord's subclasses are used in the app, there won't
be instances of ABRecord subclasses either.
This meant the linker removed all of ABRecord's interfaces, including
INativeObject.
We have API that uses ABRecord in the signature. The registrar needs to know
if a particular type is an INativeObject, which is determined by checking if
the type implements the INativeObject interface. Since the INativeObject
interface implementation was removed, the registrar determined that the
ABRecord type in the signature is invalid, and showed an error:
Error MT4136: The registrar cannot marshal the parameter type 'AddressBook.ABRecord' of the parameter 'address' in the method 'PassKit.PKPaymentAuthorizationViewController/_PKPaymentAuthorizationViewControllerDelegate.DidSelectShippingAddress(PassKit.PKPaymentAuthorizationViewController,AddressBook.ABRecord,PassKit.PKPaymentShippingAddressSelected)
The actual problem is not the linker change, but the fact that a signature
uses an abstract type. At runtime, this will cause problems if we ever need to
instantiate such a managed type: we can't. This is generally not a problem for
NSObject subclasses, because we can determine the runtime type of the object,
and that's usually [1] some other, non-abstract type. However, for
INativeObjects, we can't find a better type at runtime (because we can't
determine the runtime type of the object), so we're left with trying to
instantiate the exact type in the signature. If this is an abstract type,
things will go badly.
So make ABRecord non-abstract.
Fixes https://github.com/xamarin/xamarin-macios/issues/6654.
[1] Usually, but not always, as history has shown. See also https://github.com/xamarin/xamarin-macios/issues/4969.
* [registrar] Fix a generics type issue with dynamic registrar
Fixesxamarin/xamarin-macios#6567
This Fixes an issue in the registrar where the dynamic registrar
misses a case to check for a NSObject constraint triggered by UIKit's
`NSDiffableDataSourceSnapshot` object.
This also enables the rest of missing bindings in UIKit for Xcode 11 B4
which also works as a test case for the registrar fix. Without this fix
introspection test would throw an `AggregateException` and also
includes `NSDiffableDataSourceSnapshotTest` to check that the created
objects are usable.
* Check for Xcode 11 in tests
* Exclude the macOS in our UIKit tests ツ
* first run through but errors
* fixed switching attributes
* adding methods to be continued
* passes intro, one issue with xtro
* added common-Photos.ignore and filled feedback with Apple. Also corrected whitespace and spacing
* minimizing a diff change
* first round of changes
* fixed more errors, but expecting few more changes
* made a comment better
* added Photos/PHChangeRequest.cs but have compiler issue
* actually adding PHChangeRequest file to frameworks.sources
* changing attributes
* changed some ints to PHLivePhotoRequestID
* reverting changes
* adding mac attribute
* removing onlyOn64
* fixing attributes
* changed new base class attributes, need to test still
* This should be final fix in photos, changing PHChangeRequest mac support back to 10,15
* Updated comment
* Updated comment yet again
* removed tv todo
Apple returns an internal wrapper object depending on the context the API
is used for the following properties
* ASAuthorization.Provider
* ASAuthorization.Credential
* ASAuthorizationRequest.Provider
The provider objects have a common interface IASAuthorizationProvider
and the Credential objects have IASAuthorizationCredential since the
objects that implement these protocols inherit from NSObject and Apple
returns the internal wrapper object we cannot have the runtime do the
right cast for us so we expose a generic API constrained to
* NSObject, IASAuthorizationProvider
* NSObject, IASAuthorizationCredential
Respectively so now we are able to do something like
* adding MediaPlayer, but needs to wait for AVFoundation to be completed
* changing deprecated messages
* removing onlyOn64
* reformatted deprecated messages
* adding the watch todo back in
* removing todo comment since actual todo is there now
This is needed in a case like:
```csharp
[Unavailable (PlatformName.UIKitForMac)][Advice ("This API is not available when using UIKit on macOS.")]
[NoWatch, NoTV, Mac (10,15), iOS (13,0)]
enum ASAuthorizationProviderAuthorizationOperation {
// no value yet - but we must handle `nil` as a default value
[DefaultEnumValue]
[Field (null)]
None,
}
```
IOW we want to expose the smart enum for it's only `null` value
but the general conversion code is not available (for a `Weak`
version of the property)
The upcoming update for `authenticationservices.cs` depends on this fix.
* Bump for Xcode 11 beta 4
xtro tests will fail until we have an update for sharpie, however
the introspection tests should be fine (with the small changes in
arkit.cs and uikit.cs)
xtro failure:
```
System.NotImplementedException: AVAudioInteger
at (wrapper managed-to-native) Clang.Ast.AstReader.LoadInternal(Clang.Ast.AstReader,string)
at Clang.Ast.AstReader.Load (System.String astPath) [0x00014] in /Users/builder/vsts-agent/_work/5/s/Clang/Ast/AstReader.cs:33
at Extrospection.Runner.Execute (System.String pchFile, System.Collections.Generic.IEnumerable`1[T] assemblyNames) [0x0019a] in /Users/poupou/git/xcode11/xamarin-macios/tests/xtro-sharpie/Runner.cs:54
at Extrospection.MainClass.Main (System.String[] args) [0x00046] in /Users/poupou/git/xcode11/xamarin-macios/tests/xtro-sharpie/Program.cs:20
```
due to
```diff
-typedef CF_ENUM(NSInteger, AVAudioSessionErrorCode) {
+typedef CF_ENUM(AVAudioInteger, AVAudioSessionErrorCode) {
```
https://github.com/xamarin/xamarin-macios/wiki/CoreAudioTypes-iOS-xcode11-beta4
* [tests] CoreText stopped reporting error when font files are missing
* Fix xtro (EnumCheck.cs) and update its data files
* Fix xtro results (due to some local changes)
* Use the commonly used casing for `MSBuildSDKsPath` property
Handle "incorrectly" cased msbuild property names
msbuild property names are case insensitive. While generating the custom
app.config, in `SetToolsetProperty(..)` we try to update the property if
it already exists. But the name lookup was case sensitive, thus causing
the lookup to fail, resulting in two entries for the same property name
differing only in case. Eg. `MSBuildSDKsPath` vs `MSBuildSdksPath`.
* [mtouch] Whitelist new Brotli native symbols in Xamarin.Tests.Misc.PublicSymbols test
* [mtouch] Better assert in NoLLVMFailuresInWatchOS() test
We'd list the "LLVM failed" messages before even though the AOT might've crashed and the list is meaningless. Assert the exit code before that.
* [mtouch] Use new LLVM even for 32bit targets
See https://github.com/mono/mono/issues/14841 and https://github.com/mono/mono/issues/9621
* [mtouch] Work around slow LLVM in "don't link" test
See https://github.com/mono/mono/issues/14843
* Remove useless conditional
* Remove LLVM36 from Makefile
* [watch4] set right min version for arm64_32 based watch devices (#6307)
Fixes the confusion around `libmono-native*` (see for example ce5ba1e41d (commitcomment-33834491) ) when building with `MONO_BUILD_FROM_SOURCE=1`.
* reflect watchos64_32_version_min change from mono sdk
* Move mono hash info to mk/mono.mk so that existing scripts work.
* Add Makefile dependency on mono.mk where necessary
With 3e7bc29ade the Mono hash was moved from Make.config to mono.mk.
We need to add a Makefile dependency on this file wherever Make.config was used to track a Mono dependency.
* [tests] Copy mk/mono.mk to the XM test package.
* [tests] Update minOS version test after consolidating min watchOS versions everywhere.
Fixes this mtouch and mmptest failure:
1) Failed : Xamarin.Tests.ProductTests.MinOSVersion(watchOS,MinwatchOS,WatchOSSimulator,False)
Failures
Expected: <empty>
But was: < "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (mono-runtime-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (bindings-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (bindings-generated-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (shared-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (runtime-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (trampolines-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (trampolines-invoke-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (xamarin-support-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (nsstring-localization-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (trampolines-varargs-debug.arm64_32.o)."... >
* [mmp] Fix make clean target
It needs an -r to remove directories:
```
rm: bin: is a directory
rm: obj: is a directory
```
* Add new xamarin_timezone_get_local_name() to a few more places
This includes:
* 32-bit version of Xamarin.Mac.dll and OpenTK.dll
* XamMac.dll and XamMac.CFNetwork.dll
* 32-bit versions of the runtime libraries (libxammac.a and friends).
* 32-bit version of the partial static library for Xamarin.Mac.
* Classic support in the generator.
We still ship a few Classic files so that Visual Studio for Mac continue to detect that Xamarin.Mac is installed (otherwise VSfM won't open Classic projects, which makes it impossible to use the migration wizard).
This makes our build slightly faster.
Partial fix for #6300.
* [UIKit] Partial update to Xcode 11 Beta 1, 2 and 3 - Part 2 of ?
Missing bindings for
* NSDiffableDataSourceSnapshot
* UICollectionViewDiffableDataSource
* UITableViewDiffableDataSource
due to a registrar issue git generics.
* Update src/UIKit/UIFont.cs
Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
* Update src/uikit.cs
* More feedback
This also disables
* FloatRangeTest.Equals
* FloatRangeTest.ManagedVersusNative
due to https://github.com/xamarin/maccore/issues/1885
* [UIKIt] Start fixing `UITextWritingDirection` situation
But the complete fix is for another time https://github.com/xamarin/xamarin-macios/issues/6573
* carplay beta3 updates
* fixesxamarin/maccore#1822, fix enum format
* update .cs and .ignore to reflect feedback
* update .cs and .ignore to reflect feedback
* update .cs and .ignore to reflect feedback
* remove incorrect [abstract]
* remove Make.config from PR
* trying to remove .config from PR again...
* Trying to remove .config...again...