We have a test for CGFunction, and in iOS 12 the behavior changed where
previously the CGFunction was invoked immediately when rendering, it's now
retained and only called later.
This is troublesome for the test, because it disposes the managed CGFunction
when it thinks it's completed. Since the function is invoked way later, the
test now crashes. Ops.
The obvious fix is to change the test to dispose the CGFunction later. This
falls flat when finding out that "later" is undetermined. Native code retains
the CGFunction, and can do whatever it wishes with it until it's released, and
there's no way to know when that is.
OK: what about not disposing the CGFunction, and letting the GC do its job?
This also falls flat, because there's a circular reference between the native
CGFunction and the managed wrapper, preventing any of them from being released
automatically by the GC. The only way to break the circular reference is to
dispose the managed wrapper.
So, can we fix the circular reference? Unfortunately not, because we can't
monitor the native CGFunction's retain count, which is required in order to
switch the native->managed link between weak and strong according to the
retain count.
This leaves one solution (that I could come up with at least): make sure
everything works fine after disposing the managed wrapper.
This involves a few things:
* Only break the native->managed connection (the 'gch' GCHandle) when the
native CGFunction is freed. This is accomplished by using the API provided
by Apple for exactly that purpose (the 'release' callback field in the
'CGFunctionCallbacks' struct).
* Use a static variable for the 'CGFunctionCallback' struct and its contents.
This solves another potential problem: the GC could have collected the
delegate to the 'EvaluateCallback' function at any point.
* Don't null out the 'evaluate' delegate in Dispose. This leaves the user with
no way to break a potential circular reference through that delegate (since
it will never be null), so provide a property that makes it possible for
users to explicitly null out the delegate ('EvaluateFunction').
* Only call the 'evaluate' callback if it's not null.
This also has the additional advantage that test (and any customer code
running into the same issue) works without modifications.
- Fixes#4576: [xcode10] 'Metal Game' fails to build. (https://github.com/xamarin/xamarin-macios/issues/4576)
In Xcode 10 Apple moved the "metal" binary from `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal` to `/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal`.
Only use Xcode 9.4 to build 32-bit mac binaries, we don't need it to build
anything else.
This way we can revert 7227d8c478, which is
causing issue #4582 (that commit changed variables containing SDK paths to be
SDK version agnostic, so that the variables could be used for all Xcode
versions - but that unfortunately triggers an obscure ld bug. If we don't need
those variables to refer to Xcode 9.4 paths, they can contain versions just
fine).
Fixes https://github.com/xamarin/xamarin-macios/issues/4582.
The generator had a small bug in which we would get a NRE when a
property missed a Export attribute and had no WrapAttr. The issue is due
to the fact that an || is being used and does not shortcut when the
attribute is missing. In that case, the first Get check would pass and a
second attempt would happen with the set. In the case the set is missing,
we would get a NRE. The correct way is to ensure that we do have the get
and the set BEFORE the attr is checked.
The added test shows an example of the issue.
Some of the tests fail because the assert is looking at the wrong iOS
version. Looking at the API definitions:
* UIStackView - Available in iOS 9, not iOS 8.
* AudioServicesPlayAlertSoundWithCompletion - Available in iOS 9, not
iOS 8.
All the other tests reported in the issue pass.
Issue: https://github.com/xamarin/xamarin-macios/issues/4437
The public API was removed a long time ago (with XAMCORE_2_0) but
the p/invoke was still present in the platform assemblies.
Since tvOS requires bitcode this can cause a problem when linking
natively since a direct call won't be possible. That would only
happen if the symbol is removed (from the binary, not just the
headers) and if the managed linker is not enabled (otherwise it
will always be removed).
* [jenkins] Only XM apps with variations are Classic/32-bit apps, so adjust ignore logic accordingly. Fixes maccore issue 884.
Fixes https://github.com/xamarin/maccore/issues/884.
* [mmp] Fix passing -stdlib=libc++ to clang.
* [tests] Fix 32-bit XM issues.
* [xharness] Add support for building 32-bit XM apps by using Xcode 9.4.
* [xharness] Since xharness can now build 32-bit mac apps, enable them by default.
* Remove debug code.
* Remove unused variable.
Implement support for slack notifications.
Notifications will only be sent when something fails, and unfortunately I wasn't able to make notifications ping due to https://github.com/jenkinsci/slack-plugin/issues/353.
* [CoreGraphics] Add CGPDFArray.Get* overloads that take a nint index, since the CGPDFArray.Count property returns nint.
This makes the following code work:
for (var i = 0; i < array.Count; i++)
array.GetInt (i, ...)
* Don't add [MonoPInvokeCallback] to Mac code.
* [CoreGraphics] Rename CGPDFArray.ApplyBlockCallback to ApplyCallback.
Since the fact that the method is implemented using a block is not relevant
for managed code.
This also makes the method named like an equivalent method in CGPDFDictionary.
* [CoreGraphics] Change CGPDFArray.Apply to take an 'object' as the info parameter instead of IntPtr.
This makes it nicer for managed code.
* [CoreGraphics] CGPDFArray.Apply: resolve the iterated object to the actual CGPDFObject type.
* [CoreGraphics] Add an CGPDFDictionary.Apply overload that resolves the iterated object to the actual CGPDFObject type.
This method was previously only available in Classic, so I just reintroduced
it with a few changes to make the API nicer (which isn't a breaking change
since we're not building Classic anymore).
* [tests] Add test for CGPDF types.
* [tests] Don't run the new tests unless the SDK was part of Xcode 10
Apple removed `MPMoviePlayerController_iAdPreroll.h` in beta 5.
The deprecation existed, but indirectly, on `MPMoviePlayerController`,
the type on which the category is based. IOW it's became obsoleted so
we're adding the attributes to match this.