Граф коммитов

517 Коммитов

Автор SHA1 Сообщение Дата
Sebastien Pouliot bc2dfe335f
[tests] Add missing availability attribute and adjust tests to run on iOS 7 devices. Fix #4437 (#4719)
Fix https://github.com/xamarin/xamarin-macios/issues/4437 where the Mac check
always returns `true` on iOS so the `||` condition was always `true`.
2018-08-29 09:09:43 -04:00
Sebastien Pouliot d99be7a03e
Merge d15-8 into xcode 10 2018-08-21 09:29:35 -04:00
Sebastien Pouliot d9edf5928d
[avfoundation] Deprecate 'AVMediaTypeTimedMetadata' (#4655)
AVMediaTypeTimedMetadata has been obsoleted since iOS 6 but was totally
removed (returns null) in iOS 12.

Adjust test and provide a (better) deprecation warning for developers.
2018-08-21 08:57:44 -04:00
Manuel de la Pena 92d6e94707 [NaturalLanguage] Change return type to use double instead on nuint. Fixes #4642 (#4654)
The docs or headers do not specify the exact type. Using double to be
sure.

Issue: https://github.com/xamarin/xamarin-macios/issues/4642
2018-08-20 21:44:24 -04:00
Sebastien Pouliot 213590b3c0
[tests] Re-enable AVPlayerViewController.PrepareForPrerollAds test (broken in early betas) (#4656) 2018-08-20 21:15:58 -04:00
Sebastien Pouliot c7e791a514
[tests] Re-enabled CIBarcodeGenerator tests (failed in earlier betas) (#4651) 2018-08-20 15:26:59 -04:00
Rolf Bjarne Kvinge 5f4327ab0f
[CoreGraphics] Fix CGFunction to work after being disposed. (#4644)
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.
2018-08-20 07:40:54 +02:00
Rolf Bjarne Kvinge 965e1f7bcc Merge remote-tracking branch 'origin/xcode10' into xcode10-rebase-15.8 2018-08-16 17:09:30 +02:00
Vincent Dondain 3548c44782
[metal] Update for Xcode 10 beta 1, 2, 3 & 4 (#4562) 2018-08-15 10:09:23 -04:00
Vincent Dondain eec95e881c Merge branch 'd15-8' into xcode10-rebase-15.8 2018-08-13 21:04:56 -04:00
Sebastien Pouliot 0b7265193a
[coreservices] Update up to beta 5 (#4590)
Also avoid creating NSString instances for hidden constants where
only the handle is every used.
2018-08-08 12:38:03 -04:00
Manuel de la Pena 82d21bc211
[Tests] Fix failing tests on iOS 8. Fixes #4437 (#4592)
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
2018-08-08 16:14:04 +02:00
Rolf Bjarne Kvinge c77f191064 [CoreGraphics] Add missing API added in Xcode 10 beta 1. (#4547)
* [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
2018-08-02 20:30:41 -04:00
Alex Soto b808213465 [Vision] Update bindings to Xcode 10 beta 1, nothing in beta 2 (#4321) 2018-08-01 10:50:13 -04:00
Miguel de Icaza 49bb4aa0ca Xcode10 CoreGraphics B1-B5 (#4198)
* [CoreGraphics] Add first batch of Xcode10 APIs, added an enum that we did not surface before

* [xcode10] CoreGraphics support

* Fix whitespace/formatting and add comma after last enum value.

* Make CFPropertyList follow normal INativeObject creation pattern.

* Make CFPropertyList.AsData return the error as a tuple.

* Fix CFPropertyList.AsData to not leak.

* CFPropertyList.Value: use Runtime.GetNSObject so that we don't accidentally create duplicate wrappers for the same native object.

* [CoreGraphics] Update to beta 5.

* Update xtro definitions.

* Add tests.

* Don't compare value type with null.

* Use PascalCase for named return tuples.

* [CoreFoundation] Make CFPropertyList enums native and fix code accordingly.

* [tests] Fix fetching 64-bit int to actually fetch a 64-bit int and not a nint.

* [tests] Teach introspection's ApiCMAttachmentTest about CFPropertyList.
2018-08-01 16:25:40 +02:00
Sebastien Pouliot 745ac8f1db
[foundation] Override Message property in NSErrorException. Fixes #4133 (#4176)
The default `Message` property is not every helpful. Better information
is available inside the `Error` property but it's not general (nor cross
platform) when dealing with exception.

Include unit tests (on an existing test checking NSError values)

https://github.com/xamarin/xamarin-macios/issues/4133
2018-08-01 09:18:04 -04:00
Rolf Bjarne Kvinge 215ab7fc1a
[mtouch] Unify code to detect and handle frameworks that aren't supported in the simulator. Fixes #4422. (#4510)
Unify the code to detect frameworks that aren't supported in the simulator (we
had switches in two places, now this data is stored per framework).

Also remove some of the Metal frameworks for some of the platforms from these
lists (since they're now available in the simulator in some cases), which
fixes #4422.

It also seems CoreAudioKit is now available in the simulator (it wasn't in the
first Xcode 7 beta, but apparently added in a later beta. This made our
exclusion incorrect, but we never noticed).

https://github.com/xamarin/xamarin-macios/issues/4422
2018-07-27 16:30:08 +02:00
Chris Hamons 6d039cb969
Foundation for Xcode 10 Beta 1-2 (#4375)
- Work around #4441 by commenting out binding until fixed
2018-07-13 14:27:29 -04:00
Manuel de la Pena 62017a1405
[iAd] Xcode 10 beta 3 support. (#4425) 2018-07-13 16:23:44 +02:00
Vincent Dondain 2f89775fc2 [arkit] Update to Xcode 10 beta 3 (#4406)
- Updated some ARReferenceObject APIs based on their (better) Swift names. Breaking changes but on new APIs.
- Update ARReferenceObjectTest for device (center and extent have real values on device).
- Reuploaded an arobject file from Beta 3 just in case because of: "ARReferenceObject and ARWorldMap data generated using iOS 12 beta 2 or earlier isn’t compatible with beta 3 or later. Please rescan your objects to generate new ARReferenceObject and ARWorldMap data."
2018-07-05 22:36:33 -04:00
Alex Soto 79e1392823
[Intents|UI] Update bindings to Xcode 10 Beta 3 (#4402) 2018-07-05 15:36:24 -05:00
Rolf Bjarne Kvinge b8b6ef3f5f
Merge pull request #4278 from rolfbjarne/jenkins-mojave
[tests] Run Xamarin.Mac tests on Mojave, and add more Xamarin.Mac tests.

* Add more Xamarin.Mac tests: introspection, link sdk, link all and xammac_tests.
* Fix TextureAtlasTest.Empty to not crash due to Apple not liking null callbacks. (#4003)
* Run Xamarin.Mac tests on Mojave as well, even though the build OS is an earlier OS (High Sierra).
2018-07-05 18:43:17 +02:00
Rolf Bjarne Kvinge 849453a612 [monotouch-test] Adjust DlfcnTest.OpenClose_libSystem to work with Xcode 10. Fixes #4377. (#4391)
Fixed https://github.com/xamarin/xamarin-macios/issues/4377.
2018-07-04 20:38:45 -04:00
Rolf Bjarne Kvinge 1b12348e57 [tests] Refactor API to check/assert current OS version. 2018-07-04 12:35:15 +02:00
Rolf Bjarne Kvinge bcfd6290c3 Merge remote-tracking branch 'origin/xcode10' into jenkins-mojave 2018-07-04 12:35:10 +02:00
Rolf Bjarne Kvinge 17093d4311 [tests] Make MTLDeviceTests work on macOS systems that don't support metal. (#4059) 2018-07-04 00:21:45 +02:00
Rolf Bjarne Kvinge fe8e2cc439 [monotouch-test] Cope with potential symlinks when comparing bundle paths. 2018-07-03 20:47:14 +02:00
Rolf Bjarne Kvinge 392d74754e [monotouch-test] Fix NRE in CentralManagerTest's TearDown method, and improve some failure scenarios. 2018-07-03 20:47:14 +02:00
Rolf Bjarne Kvinge d3baa2b635 [monotouch-test][EventKit] Check for permission before putting up dialogs for EKEventStore. 2018-07-03 20:47:14 +02:00
Rolf Bjarne Kvinge 517bd6b506 [monotouch-test] Fix typo in test name. 2018-07-03 20:47:14 +02:00
Rolf Bjarne Kvinge eaf1e567ac [monotouch-test][CoreGraphics] Fix P/Invokes to work on all platforms. 2018-07-03 20:47:14 +02:00
Rolf Bjarne Kvinge 51cdac8e60 [monotouch-test] Implement a cross-platform way of converting UIColor/NSColor to GCColor, and use it. 2018-07-03 20:47:14 +02:00
Rolf Bjarne Kvinge 5fbb714c09 [monotouch-test] Remove Classic tests and any version checks for versions earlier than the minimum deploymnent target. 2018-07-03 20:47:14 +02:00
Rolf Bjarne Kvinge 9703f17c91 [monotouch-test] Fix versions checks.
* Fix many version checks to be based on Xcode version instead of iOS version.
* Added/fixed a few expected values according to platform version to match behavior in older macOS versions.
2018-07-03 20:47:14 +02:00
Rolf Bjarne Kvinge cbb637630b [tests] Remove Classic-only tests. 2018-07-03 16:57:16 +02:00
Alex Soto 709e855c15
[CoreText] Update bindings to Xcode 10 Beta 1 & 2 (#4368)
* [CoreText] Update bindings to Xcode 10 Beta 1 & 2

* Adds tests and unbreaks API

* Check for Xcode 10 in tests
2018-07-03 09:48:10 -05:00
Rolf Bjarne Kvinge c3237f5d10 [tests] Fix TextureAtlasTest.Empty to not crash due to Apple not liking null callbacks. (#4003)
[tests] Fix TextureAtlasTest.Empty to not crash due to Apple not liking null callbacks.
2018-07-02 19:05:27 +02:00
Alex Soto e45838a1e8
Fix GetMatchingFontDescriptors overload with sort callback (#3871) (#4373)
It incorrectly returned array of arrays instead of array of CTFontDescriptors.

Add CTFontCollectionTest
2018-06-29 16:05:00 -05:00
Sebastien Pouliot 4da64a8355
[systemconfiguration][tvos] CaptiveNetwork API are now marked as prohibited in tvOS (#4357) 2018-06-29 09:35:05 -04:00
Rolf Bjarne Kvinge e110612118
[registrar] Improve error message when failing to create a managed wrapper for a native handle. (#4360)
* Convert it into a MM8027/MT8027 error (with documentation).
* Add information about the selector and managed method that triggered the error.

Now the problem reported in issue #4254 shows up as:

> ObjCRuntime.RuntimeException: Failed to marshal the Objective-C object 0x7f8080412810 (type: UIView). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'UIKit.UIView&' does not have a constructor that takes one IntPtr argument).
> Additional information:
> 	Selector: popoverController:willRepositionPopoverToRect:inView:
> 	Method: UIKit.UIPopoverController+_UIPopoverControllerDelegate.WillReposition(UIKit.UIPopoverController, CoreGraphics.CGRect ByRef, UIKit.UIView ByRef)

instead of just:

> ObjCRuntime.RuntimeException: Failed to marshal the Objective-C object 0x7f8080412810 (type: UIView). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'UIKit.UIView&' does not have a constructor that takes one IntPtr argument).

which makes it much easier to understand, track down, and fix/work around,
both for customers and ourselves.
2018-06-29 14:38:28 +02:00
Rolf Bjarne Kvinge d79bef79a0
[ObjCRuntime] Make Class.GetHandle not handle byref types. Fixes #4254. (#4361)
* [ObjCRuntime] Make Class.GetHandle not handle byref types. Fixes #4254.

This is a regression between d15-6 and d15-7: it's an unindented consequence
of the changes required to link away the dynamic registrar.

This unindented consequence is non-obvious: it made Class.GetHandle
successfully look up byref types, since we're now using metadata tokens to
look up a Class from the managed Type, and it turns out the metadata tokens
are the same for byref types as the corresponding non-byref type, so
Class.GetHandle treats them identically.

This was not the behavior for Class.GetHandle in d15-6, and other code relied
on this behavior (in particular calling isKindOfClass: in Runtime.GetNSObject
with a nil class returns false, and we'd end up in a different code path that
would not try to create the managed peer with a byref type).

So make sure Class.GetHandle doesn't change its behavior compared to d15-6 by
special-casing byref types to return IntPtr.Zero.

Fixes https://github.com/xamarin/xamarin-macios/issues/4254.

* Move byref check earlier to get identical behavior when the dynamic linker is optimized away.

Also add checks for pointer and array types for the same reason.
2018-06-29 14:33:55 +02:00
Rolf Bjarne Kvinge 5245cfab14
[Foundation] Fix NSDictionary string indexers. (#4335)
Creating a new NSString doesn't always lead to creating a new NSString, which
will obviously cause trouble.

The scenario is:

* An NSString with the value @"Bye" is added to an NSDictionary, with the same
  string as both the key and the value.

* The (managed) string indexer is used to try to get the value back. The
  string indexer would call 'new NSString ("Bye")', which would create a new
  managed NSString, and maybe a new native NSString (or maybe it would re-use
  an existing NSString). Then the handle of this NSString would be passed to
  the native API, and the same handle would come back as the result (since the
  same string is both the key and the value). We'd call Runtime.GetNSString on
  the returned handle, get back the same managed instance that was created
  just before the call to the native method. Finally, just before returning
  this managed instance from the indexer, we'd dispose it... since it was
  created in a 'using' block. Then we'd return a disposed NSString object from
  the indexer. Ops.

The fix is to not create a managed wrapper for the NSString handle we need to
pass to the native API, but create and free the native NSString object without
using a managed wrapper.
2018-06-28 14:57:41 +02:00
Rolf Bjarne Kvinge 06fd4029f3
[generator] Fix generated code for INativeObject properties in filters: we don't own such objects. (#4330)
Fixes a crash in the MonoTouchFixtures.CoreImage.FilterTest.ColorSpace on macOS 10.9 and 10.10:

    Assertion failed: (!space->is_singleton), function color_space_dealloc, file ColorSpaces/color-space.c, line 102.
    Stacktrace:

      at <unknown> <0xffffffff>
      at (wrapper managed-to-native) CoreGraphics.CGColorSpace.CGColorSpaceRelease (intptr) [0x00009] in <7709ef494bc84be8a727c0b1d19c4344>:0
      at CoreGraphics.CGColorSpace.Dispose (bool) [0x00016] in /Library/Frameworks/Xamarin.Mac.framework/Versions/4.99.0.103/src/Xamarin.Mac/CoreGraphics/CGColorSpace.cs:116
      at CoreGraphics.CGColorSpace.Finalize () [0x00002] in /Library/Frameworks/Xamarin.Mac.framework/Versions/4.99.0.103/src/Xamarin.Mac/CoreGraphics/CGColorSpace.cs:94
      at (wrapper runtime-invoke) object.runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr) [0x0001f] in <ea4ecc87ef1044a98fc1b5fdb59119e7>:0

    Native stacktrace:

    	0   xammac_tests                        0x000000010d55fc18 mono_handle_native_crash + 264
    	1   libsystem_platform.dylib            0x00007fff8d4a152a _sigtramp + 26
    	2   ???                                 0x0000000000000000 0x0 + 0
    	3   libsystem_c.dylib                   0x00007fff9aba76df abort + 129
    	4   libsystem_c.dylib                   0x00007fff9ab6edd8 basename + 0
    	5   CoreGraphics                        0x00007fff8c2b58b8 color_space_dealloc + 248
    	6   CoreFoundation                      0x00007fff87997af3 CFRelease + 371
    	7   ???                                 0x00000001248548cd 0x0 + 4907681997
    	8   ???                                 0x000000012416a13c 0x0 + 4900430140
    	9   xammac_tests                        0x000000010d5f7d0e mono_gc_run_finalize + 734
    	10  xammac_tests                        0x000000010d6e859a sgen_gc_invoke_finalizers + 234
    	11  xammac_tests                        0x000000010d5f9754 finalizer_thread + 756
    	12  xammac_tests                        0x000000010d6ae930 start_wrapper + 704
    	13  libsystem_pthread.dylib             0x00007fff8ae8999d _pthread_body + 131
    	14  libsystem_pthread.dylib             0x00007fff8ae8991a _pthread_body + 0
    	15  libsystem_pthread.dylib             0x00007fff8ae87351 thread_start + 13

On newer macOS versions, the API that returns a CGColorSpace returns a global
object that can't be retained/released, and thus won't crash since the
CGColorSpace is never freed.
2018-06-25 10:47:14 +02:00
Vincent Dondain 2f1859733d
[arkit] Update to Xcode 10 beta 1 (ARKit 2.0) (#4209)
I obsoleted `GetProjectPoint` in favor of `Project` because of the introduction of `Unproject` (which made me realize the naming was wrong) and based on the API doc https://developer.apple.com/documentation/arkit/arcamera/2923538-projectpoint?language=objc. 

The `CGPoint` returned is the projection of a point. An other naming option would have been `GetProjectedPoint` but I think `Project` is closer to the original and clear enough. You project/unproject something onto something else and you get the projection back.
2018-06-14 13:44:45 -04:00
Manuel de la Pena f77f44940e
[NaturalLanguage] Added the new framework for Xcode10. (#4236) 2018-06-14 19:21:44 +02:00
Sebastien Pouliot 2d6ce7459d
Bump to use Xcode 10 beta 1 (#4179)
* Bump to use Xcode 10 beta 1

* Update Versions.plist

* Add a dependency on Xcode 9.4.

* [msbuild] Fix build with Xcode 10 beta 1. (#4182)

Many years ago (in Xcode 7 according to code comment)
Developer/Platforms/iPhoneOS.platform/Developer/usr disappeared, and we coped
by looking at Developer/usr instead (and also the subsequent code to locate
the bin directory was based on the location of the usr directory).

Developer/Platforms/iPhoneOS.platform/Developer/usr reappeared in Xcode 10
beta 1, but it seems useless (for one it doesn't contain a bin directory), so
in order to try to keep things sane don't look for this directory in Xcode 10
and instead go directly for Developer/usr (which is what we've been using as
the usr directory for years anyway).

Fixes this problem when building apps with Xcode 10 beta 1:

      /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(626,3): error : Could not locate SDK bin directory [/Users/rolf/Projects/TestApp/test-app.csproj]

* [runtime] Build 32-bit mac executables using Xcode 9.4.

* [mtouch] Work around broken tvOS headers in Xcode 10 beta 1.

* [mtouch] Work around build problem with Apple's simd headers in Objective-C++ mode.

* Use version-agnostic paths to sdk directories.

* [tests][xtro] Add todo files (from unclassified) and adjust ignore files to avoid errors

* [macos][security] Re-enable SSL[Get|Set]AlpnProtocols. Fixes #4001 (#4022)

* [macos][security] Re-enable SSL[Get}Set]AlpnProtocols. Fixes #4001

This was fixed in macOS 10.13.4

https://github.com/xamarin/xamarin-macios/issues/4001

* [tests][monotouch-tests] Disable a few test cases (one crasher, other failures). Causes to be verified later

* [xharness] Fix permission dialog suppression in Xcode 10.

* [xharness] Ignore 32-bit macOS tests by default.

* [tests] Execute mmp regression tests with Xcode 9.4 since many of them are 32-bit and needs porting to 64-bit.

* [mmptest] Ignore 32-bit XM tests if we don't have a 32-bit-capable Xcode.

* [registrar] Add workaround for broken headers in Xcode 10 beta 1 (radar 40824697).

* [mtouch] Restrict another workaround for an Xcode 10 beta 1 bug to a specific Xcode version to remove it asap.

* [tests] Fix some protocol changes (public or not) find by introspection tests

* [tests][intro] Fix DefaultCtorAllowed failures

* [Intents] Obsolete several Intents classes in watchOS.

Several existing Intents classes have been marked as unavailable in watchOS in
the headers in Xcode 10 beta 1, and corresponding tests are now failing.

So obsolete the managed wrapper types, and fix tests accordingly.

* Fix xtro wrt previous Ietents/intro changes

* [tests] Minor adjustments to mtouch tests to work with Xcode 10.

* [msbuild] Update tests to cope with additional files produced by the Core ML compiler.

* [msbuild] Xcode 10 doesn't support building watchOS 1 apps, so show a clear error message explaining it.

Also update tests accordingly.

* [coreimage] Stub new filters and exclude ?removed? ones from tests

* Update GameplayKit and SpriteKit NSSecureCoding _upgrade_ and fix other non-public cases (in tests)

* [tests] Ignore some GameKit selectors that don't respond anymore (but seems to be available, at least in header files)

* [tests] Fix intro 32bits testing for filters resutls

* [msbuild] Slightly change error message to be better English.
2018-06-08 18:45:24 -07:00
Manuel de la Pena c4a64ad7d9 [Compression] Ensure we use the correct linking flags for older versions. Fixes #4129. (#4169) (#4184)
Libcompresison was added after iOS 9.0, TvOS 9.0, MacOS 10.11 and watchOS
2.0. We want to use weak in those older platforms.

Fixes issue https://github.com/xamarin/xamarin-macios/issues/4129
2018-06-05 14:56:49 -04:00
Manuel de la Pena aa7c95eca7
[Compression] Ensure we use the correct linking flags for older versions. Fixes #4129. (#4169)
* [Compression] Ensure we use the correct lonking flags for older versions. Fixes #4129.

Libcompresison was added after iOs 9.0, TvOS 9.0, Mac 10.11 and Watch
2.0. We want to use weak in those older platforms.

Fixes issue https://github.com/xamarin/xamarin-macios/issues/4129
2018-06-05 09:12:27 -07:00
kunigaku 07356b8391 [foundation] Fix empty NSData.ToArray() crash (#4103) 2018-05-18 14:52:47 -04:00
Manuel de la Pena f765d674d3 [Compression] Add compression framework bindings. (#3942) 2018-05-11 15:54:31 -04:00
Rolf Bjarne Kvinge 285062208d
[tests] Make MTLDeviceTests work on macOS systems that don't support metal. (#4059) 2018-05-09 15:14:42 +02:00
Sebastien Pouliot 380821fa1a
[coretext] Enable CTFont tests on watchOS and macOS. Fixes #3925 (#4035)
`CTFontCreateWithGraphicsFont` is actually available on macOS and watchOS,
so it's enabled, in `CGFont`, along with its unit test.

https://github.com/xamarin/xamarin-macios/issues/3925
2018-05-04 13:32:59 -04:00
Sebastien Pouliot 353ce95c70
[macos][security] Re-enable SSL[Get|Set]AlpnProtocols. Fixes #4001 (#4022)
* [macos][security] Re-enable SSL[Get}Set]AlpnProtocols. Fixes #4001

This was fixed in macOS 10.13.4

https://github.com/xamarin/xamarin-macios/issues/4001
2018-05-02 20:32:30 -04:00
Rolf Bjarne Kvinge 3385b68e5a
[monotouch-test] Fix WeakReferenceTest.WeakTest to work on watchOS/LLVM. (#4010)
Change WeakReferenceTest.WeakTest so that it doesn't fetch values that should
be garbage collected on the main thread.

Doing so on the main thread may cause those values to stay in registers as
temporary values, thus preventing the garbage collector from collecting them.

Instead do the fetching in a background thread, whose stack won't exist
anymore once it's finished.

Fixes this test failure when running on watchOS device in release mode:

    [FAIL] WeakReferenceTest.WeakTest : 't.Obj4' should be null

The reason it only happens on watchOS in release mode, is probably because
LLVM puts temporary values in different registers than Mono's AOT compiler
does.
2018-04-30 12:50:10 +02:00
Rolf Bjarne Kvinge f7ce5b91c5 [monotouch-test] Make BundleTest.TestPreferredLocalizations laxer. (#4005)
Change test to verify that all preferred localizations are in the list of
available localizations (instead of hardcoding an expected result of 'en').

This makes the TestPreferredLocalizations work if the device language is 'es',
in which case the preferred language between 'en' and 'es' is obviously 'es'.
2018-04-27 12:00:17 -04:00
Rolf Bjarne Kvinge 73f6bf0722
[tests] Determine at runtime instead of compile time whether LinkAll is enabled. Fixes #3812. (#4004)
* [tests] Determine at runtime instead of compile time whether LinkAll is enabled. Fixes #3812.

This way we can remove the LINKALL define, which also means nobody can forget
to define it when building using LinkAll.

https://github.com/xamarin/xamarin-macios/issues/3812
2018-04-27 13:11:27 +02:00
Rolf Bjarne Kvinge 7cbaa2d1a2
[tests] Fix TextureAtlasTest.Empty to not crash due to Apple not liking null callbacks. (#4003)
[tests] Fix TextureAtlasTest.Empty to not crash due to Apple not liking null callbacks.
2018-04-27 07:37:27 +02:00
Sebastien Pouliot bf159969f9
[foundation] Avoid unnecessary native calls for NSNull.Null. Fixes #3544 (#3984)
Repetitive calls to `NSNull.Null.Handle`, e.g. from `NSArray.UnsafeGetItem<T>`,
means several (one by item), costly, calls into ObjC code - but it always
return the same (native) singleton.

This manually cache the managed `NSNull.Null` static value, once it's
initialized the first time, so future calls won't have the performance
penalty.

https://github.com/xamarin/xamarin-macios/issues/3544
2018-04-26 09:24:46 -04:00
Filip Navara 865ee621dc Fix GetMatchingFontDescriptors overload with sort callback (#3871)
It incorrectly returned array of arrays instead of array of CTFontDescriptors.

Add CTFontCollectionTest
2018-04-13 10:22:02 -04:00
Vincent Dondain 2a84c116db Merge branch 'xcode9.3' 2018-04-03 14:14:07 -04:00
Vincent Dondain d34f1fbbd7 Merge branch 'xcode9.3' into d15-7-merge-xcode9.3 2018-03-29 19:31:01 -04:00
Alex Soto da6db5f660
[monotouch-tests] Adds mono's WeakAttribute tests (#3739) (#3760)
* [monotouch-tests] Adds mono's WeakAttribute tests

* Embrace watchOS

Unfortunately this revealed that WeakAttribute is not working for watchOS

* Port mono's WeakAttribute test to our test runner

Test Ported:
5bdaef7e5f/mono/tests/weak-fields.cs

* Fix object leaks and implement suggested approach from 4b9ade0c59

* Remove debug spew and fix formating on header
2018-03-16 08:22:05 -06:00
Alex Soto b6dbebe9d3
[monotouch-tests] Adds mono's WeakAttribute tests (#3739)
* [monotouch-tests] Adds mono's WeakAttribute tests

* Embrace watchOS

Unfortunately this revealed that WeakAttribute is not working for watchOS

* Port mono's WeakAttribute test to our test runner

Test Ported:
5bdaef7e5f/mono/tests/weak-fields.cs

* Fix object leaks and implement suggested approach from 4b9ade0c59

* Remove debug spew and fix formating on header
2018-03-15 08:29:46 -06:00
Sebastien Pouliot 1b3672e2e3
[tests][mac] Fix random failure in KeyTest.RoundtripRSAMinPKCS1 (#3737)
The behaviour is not consistent on macOS (like it is on iOS)

Fixes https://github.com/xamarin/maccore/issues/671
2018-03-14 08:00:06 -05:00
Rolf Bjarne Kvinge 98837dbfd0
[ObjCRuntime] Don't double-retain blocks. (#3717) (#3730)
First there was darkness; no blocks were retained.

Then came the light; and all blocks were retained [1]

Forever.

But all that once is, must one day not be,
and thus the light gave way to darkness,
and blocks were only retained as long as need be [2].

But before there was a balance, there was a crossroad.

In some places the light shone forever,
and all blocks were retained.

In other places there was a balance,
and the light shone only as long as needed.

A desire to unify arose.

Alas, it could not be.

It was a bright and sunny day

When a merge failed [3].

And all blocks were retained. Twice.

Once [here][4] and once [there][5].

For many years we could not see.

Until a dark and rainy night,
when an awareness arose.

And the desire to unify the balance could finally be fulfilled.

[1]: 6efca92acb
[2]: a22f877539
[3]: befa0477cf
[4]: 5158a3c001/src/ObjCRuntime/Runtime.cs (L858)
[5]: 5158a3c001/runtime/runtime.m (L2091)
2018-03-13 19:24:44 +01:00
Rolf Bjarne Kvinge 2fe44b9890
[ObjCRuntime] Don't double-retain blocks. (#3717)
* [ObjCRuntime] Don't double-retain blocks.

First there was darkness; no blocks were retained.

Then came the light; and all blocks were retained [1]

Forever.

But all that once is, must one day not be,
and thus the light gave way to darkness,
and blocks were only retained as long as need be [2].

But before there was a balance, there was a crossroad.

In some places the light shone forever,
and all blocks were retained.

In other places there was a balance,
and the light shone only as long as needed.

A desire to unify arose.

Alas, it could not be.

It was a bright and sunny day

When a merge failed [3].

And all blocks were retained. Twice.

Once [here][4] and once [there][5].

For many years we could not see.

Until a dark and rainy night,
when an awareness arose.

And the desire to unify the balance could finally be fulfilled.

[1]: 6efca92acb
[2]: a22f877539
[3]: befa0477cf
[4]: 5158a3c001/src/ObjCRuntime/Runtime.cs (L858)
[5]: 5158a3c001/runtime/runtime.m (L2091)

* [tests] Fix test builds.

* [monotouch-test] RegistrarTest.BlockCollection: allocate more and wait longer for the GC.

Allocate more objects and wait longer for the GC to run.

Hopefully fixes this problem:

    	[FAIL] RegistrarTest.BlockCollection :   freed blocks
      Expected: greater than 0
      But was:  0

The blocks are freed if we just wait long enough... The problem is that we
don't want to wait very long (makes the tests slow to run), so try to speed
things up by allocating more.
2018-03-13 12:30:32 +01:00
Rolf Bjarne Kvinge c4ddd4da1e
[monotouch-test] Adjust a few tests to cope with optimizations. (#3720)
This fixes the following test failures when building for debug with all optimizations enabled:

    DispatchTests
    	[FAIL] DispatchTests.EverAfter :   thread check hit
      Expected: same as <UIKit.UIKitThreadAccessException>
      But was:  <System.ArgumentNullException>

    		  at MonoTouchFixtures.CoreFoundation.DispatchTests.EverAfter () [0x000e1] in /Users/xamarinqa/vsts/_work/52/s/tests/monotouch-test/CoreFoundation/DispatchTests.cs:259
    		  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
    	[FAIL] DispatchTests.MainQueueDispatch :   thread check hit
      Expected: same as <UIKit.UIKitThreadAccessException>
      But was:  <System.ArgumentNullException>

    		  at MonoTouchFixtures.CoreFoundation.DispatchTests.MainQueueDispatch () [0x000d1] in /Users/xamarinqa/vsts/_work/52/s/tests/monotouch-test/CoreFoundation/DispatchTests.cs:111
    		  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
2018-03-13 10:41:38 +01:00
Alex Soto fd746c47fa
[Backport 15-7][monotouch-test] Stop MidiThruConnectionTests.FindTest from randomly failing (#3702)
* [monotouch-test] Stop MidiThruConnectionTests.FindTest from randomly failing (#3696)

Fixes xamarin/maccore#658

When a MidiThruConnection is created but for some reason is not disposed
the system keeps it alive even between app/simulator restarts, if you want
to clean the connections you must reset contents and settings from simulator.

In order to avoid this test from failing randomly and since the intent of the
test is to check if `MidiThruConnection.Find` works we change the assert to
`>= 2` since this is at least the number of connections we expect.

* [monotouch-test] Enhance MidiThruConnectionTests.FindTest from #3696 comments (#3700)
2018-03-09 12:49:33 -06:00
Alex Soto 06d390ce3e [Backport][monotouch-test] Stop MidiThruConnectionTests.FindTest from randomly failing (#3703)
Fixes xamarin/maccore#658

When a MidiThruConnection is created but for some reason is not disposed
the system keeps it alive even between app/simulator restarts, if you want
to clean the connections you must reset contents and settings from simulator.
Which is a bit harder when the issues happens on the macOS.
2018-03-09 08:12:18 -05:00
Alex Soto fc5f57ed8c
[monotouch-test] Enchance MidiThruConnectionTests.FindTest from #3696 comments (#3700) 2018-03-08 12:51:21 -06:00
Alex Soto 4d51294bdf [monotouch-test] Stop MidiThruConnectionTests.FindTest from randomly failing (#3696)
Fixes xamarin/maccore#658

When a MidiThruConnection is created but for some reason is not disposed
the system keeps it alive even between app/simulator restarts, if you want
to clean the connections you must reset contents and settings from simulator.

In order to avoid this test from failing randomly and since the intent of the
test is to check if `MidiThruConnection.Find` works we change the assert to
`>= 2` since this is at least the number of connections we expect.
2018-03-08 07:33:13 +01:00
Vincent Dondain 24e8815004
[security] Strongly typed key generation (#3502) (#3676)
* [security] Modifying structure of bindings

Added strong dictionary for key generation according to
https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/key_generation_attributes
in preparation making a strongly typed key generation possible.

* Making strong dictionary and composite of other strong dictionaries.

* Implementing access control as property type of SecPublicPrivateKeyAttrs.

* Adding new overload for SecKey.CreateRandomKey.

* Moving TokenID to strongly typed property.

* Fix coding style + use nameof

* Fixing Xcode version assertion of key generation tests.

* Fixing errors in test case.

* Fixing whitespace issue.

* Resolving inheritance issue

Removing inheritance between SecKeyGenerationParameters and
SecPublicPrivateKeyAttrs and instead add the necessary properties
to SecKeyGenerationParameters. Adds redundant code, but I don't
see a way around it.

* Moving test case to appropriate test class.

* Creating necessary strong dictionaries for key generation.

* [formatting] Mono coding guidelines

Make sure you're following http://www.mono-project.com/community/contributing/coding-guidelines/
In VSMac: Preferences > Source Code > Code Formatting > C# source code > Policy Mono.

* Remove [Advice] that are specific to GenerateKeyPair

`SecKeyGenerationParameters` and `SecKeyParameters` cannot be used for `GenerateKeyPair`.

* Clarify 'ArgumentException' for invalid 'SecKeyType'

* Fixed CreateRandomKeyTest

- Renamed CreateRandomKeyWithParametersTests to CreateRandomKeyTest.
- Add messages to all asserts.

```
keyGenerationParameters = new SecKeyGenerationParameters ();
keyGenerationParameters.KeyType = SecKeyType.Invalid;
Assert.Throws<ArgumentException> (() => { SecKey.CreateRandomKey (keyGenerationParameters, out _); }, "CreateRandomKey - invalid key type");
```
- ^ didn't work because `SecKeyGenerationParameters`'s setter protects against invalid. There's no constant for invalid so null is returned.

```
Assert.That (SecKey.CreateRandomKey (keyGenerationParameters, out _), Is.EqualTo (SecStatusCode.Param), "CreateRandomKey - Param issue, invalid RSA key size");
```
- ^ `SecKey.CreateRandomKey` doesn't return a `SecStatusCode` like `GenerateKeyPair`.

* Fixes based on spouliot's input.

* Mono styling fix.
2018-03-06 17:40:19 -05:00
mdbech 933ab0d70a [security] Strongly typed key generation (#3502)
* [security] Modifying structure of bindings

Added strong dictionary for key generation according to
https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/key_generation_attributes
in preparation making a strongly typed key generation possible.

* Making strong dictionary and composite of other strong dictionaries.

* Implementing access control as property type of SecPublicPrivateKeyAttrs.

* Adding new overload for SecKey.CreateRandomKey.

* Moving TokenID to strongly typed property.

* Fix coding style + use nameof

* Fixing Xcode version assertion of key generation tests.

* Fixing errors in test case.

* Fixing whitespace issue.

* Resolving inheritance issue

Removing inheritance between SecKeyGenerationParameters and
SecPublicPrivateKeyAttrs and instead add the necessary properties
to SecKeyGenerationParameters. Adds redundant code, but I don't
see a way around it.

* Moving test case to appropriate test class.

* Creating necessary strong dictionaries for key generation.

* [formatting] Mono coding guidelines

Make sure you're following http://www.mono-project.com/community/contributing/coding-guidelines/
In VSMac: Preferences > Source Code > Code Formatting > C# source code > Policy Mono.

* Remove [Advice] that are specific to GenerateKeyPair

`SecKeyGenerationParameters` and `SecKeyParameters` cannot be used for `GenerateKeyPair`.

* Clarify 'ArgumentException' for invalid 'SecKeyType'

* Fixed CreateRandomKeyTest

- Renamed CreateRandomKeyWithParametersTests to CreateRandomKeyTest.
- Add messages to all asserts.

```
keyGenerationParameters = new SecKeyGenerationParameters ();
keyGenerationParameters.KeyType = SecKeyType.Invalid;
Assert.Throws<ArgumentException> (() => { SecKey.CreateRandomKey (keyGenerationParameters, out _); }, "CreateRandomKey - invalid key type");
```
- ^ didn't work because `SecKeyGenerationParameters`'s setter protects against invalid. There's no constant for invalid so null is returned.

```
Assert.That (SecKey.CreateRandomKey (keyGenerationParameters, out _), Is.EqualTo (SecStatusCode.Param), "CreateRandomKey - Param issue, invalid RSA key size");
```
- ^ `SecKey.CreateRandomKey` doesn't return a `SecStatusCode` like `GenerateKeyPair`.

* Fixes based on spouliot's input.

* Mono styling fix.
2018-03-06 15:25:50 -05:00
Sebastien Pouliot 29676a3662 Merge 15.6 into xcode9.3 2018-03-05 17:16:28 -05:00
Rolf Bjarne Kvinge d0d6f4d0a2 [tests] Fix NSDataTest.Https to use a site with a valid and complete certificate chain. Fixes #644. (#3549) (#3559)
Fixes https://github.com/xamarin/maccore/issues/644.
2018-02-21 11:27:03 -05:00
Rolf Bjarne Kvinge d742f44f3a
[tests] Fix NSDataTest.Https to use a site with a valid and complete certificate chain. Fixes #644. (#3549) (#3556)
Fixes https://github.com/xamarin/maccore/issues/644.
2018-02-21 16:03:35 +01:00
Rolf Bjarne Kvinge f7d907983e
[tests] Fix NSDataTest.Https to use a site with a valid and complete certificate chain. Fixes #644. (#3549)
Fixes https://github.com/xamarin/maccore/issues/644.
2018-02-21 09:09:12 +01:00
Manuel de la Pena 688b3020f9
[Foundation] Add missing NSLinguisticAnalysis category. Fixes 35009. (#3473)
* [Foundation] Add missing NSLinguisticAnalysis category. Fixes 35009.
2018-02-16 16:21:47 +01:00
Rolf Bjarne Kvinge c838a11c4d
Merge pull request #3495 (Implement support for optimizing away the dynamic registrar) from rolfbjarne/full-static-registrar
Implement support for optimizing away the dynamic registrar.

* Add a new property (Runtime.DynamicRegistrationSupported) that indicates at
  runtime whether dynamic registration is available.

* Check this new property whenever we need dynamic registration.

* Add an optimization to mtouch/mmp that detects whether dynamic registration
  is required, and if not, changes Runtime.DynamicRegistrationSupported to
  return false.

* Add an optimization to mtouch/mmp that inlines
  Runtime.DynamicRegistrationSupported as a constant value.

The end result is that the linker will link away the dynamic registrar if
mtouch/mmp detects that it's not needed.

Benchmark
---------

I've compared the size of entire apps built for device:

|test                          | Before |  After |   Diff |     % |
|:-----------------------------|-------:|-------:|-------:|------:|
|[monotouch-test/Release][1]   | 95.7mb | 95.0mb | -680kb | -0.7% |
|[link sdk/Release][2]         | 21.2mb | 20.9mb | -245kb | -1.2% |
|[minimalistic app/Release][3] | 4.58mb | 4.32mb | -259kb | -5.7% |

[1]: https://gist.github.com/rolfbjarne/3871e36d2de8db1a8eee1d9f9276d3d2#monotouch-test-release-wall-optimizations-enabled
[2]: https://gist.github.com/rolfbjarne/3871e36d2de8db1a8eee1d9f9276d3d2#link-sdk
[3]: https://gist.github.com/rolfbjarne/3871e36d2de8db1a8eee1d9f9276d3d2#minimalistic-app
2018-02-15 23:56:00 +01:00
Alex Soto 47163efdb6
[Tests] Fixes CertificateTest for ios < 10 (#3500)
`SecKeyCopyAttributes` is iOS 10+ and is used by `GetAttributes`
2018-02-15 11:47:37 -06:00
Rolf Bjarne Kvinge 8d7f951ea3 [mmp] Don't support removal of the dynamic registrar for XM, it needs more work. 2018-02-15 10:24:31 +01:00
Rolf Bjarne Kvinge b4f0c8b729 [tests] Add test to ensure the dynamic registrar really is removed when we request it to be. 2018-02-15 10:24:30 +01:00
Rolf Bjarne Kvinge e4956ef2cf [ObjCRuntime] Look up managed types from the native class using information from the static registrar if possible. 2018-02-15 10:24:30 +01:00
Rolf Bjarne Kvinge 961878b80b [tests] Update tests to cope with removal of the dynamic registrar. 2018-02-15 10:24:30 +01:00
Vincent Dondain 9408eb081d
[security] Add new 'SecKey.GenerateKeyPair' overloads (#3438)
The new overloads allow to set `kSecPrivateKeyAttrs` and `kSecPublicKeyAttrs`.

Fixes bug #34135: Need some constants exposed in Xamarin.iOS binding
(https://bugzilla.xamarin.com/show_bug.cgi?id=34135)

The new APIs were created according to https://developer.apple.com/documentation/security/1395339-seckeygeneratepair?language=objc

Also add `GenerateKeyPairTest`.
2018-02-14 23:34:52 -05:00
Rolf Bjarne Kvinge 60a8731b35
Merge pull request #3462 from rolfbjarne/optimized-protocol-support
Add a 'register-protocols' optimization that:

Improves static registrar to:

* Generate a new table of protocol -> managed wrapper type. This is required
  to find the wrapper type without having the `[Protocol]` attribute around.

* Make the generated code implement protocols from [Adopts] attributes. This
  makes it possible to link away the `[Protocol]` attribute, because the
  native implementation of `conformsToProtocol:` does the right thing (we
  might even be able to link away our complete `ConformsToProtocol` logic when
  we remove the dynamic registrar).

Improves linker to:

* Not mark protocol interfaces by the mere virtue of having a type that
  implements them. This is implemented by not marking protocol interfaces when
  they're implementing a class, but instead when a method implementation is
  found to implement a method from a protocol interface.

* Mark the wrapper type for protocols (this allows us to remove the Protocol
  attribute, since that's the link between the protocol and its wrapper type).

* Remove the [Protocol], [ProtocolMember] and [Adopts] attributes (but only if
  optimizing protocols).

The static registrar still needs some of the information linked away, so a few
changes are required to make it available post linker.

Benchmark
---------

I've compared the size of entire apps built for device:

|test                          | Before |  After |   Diff |     % |
|:-----------------------------|-------:|-------:|-------:|------:|
|[monotouch-test/Debug][1]     |  101mb |  100mb | -888kb | -0.9% |
|[monotouch-test/Release][2]   | 99.2mb | 95.4mb | -830kb | -0.9% |
|[minimalistic app/Debug][3]   | 10.8mb | 10.4mb | -443kb | -4.1% |
|[minimalistic app/Release][4] |  4.7mb | 4.55mb | -157kb | -3.3% |

[1]: https://gist.github.com/rolfbjarne/0181ab8abe436c34cf4ee68ecfb8cd18#monotouch-test-debug
[2]: https://gist.github.com/rolfbjarne/0181ab8abe436c34cf4ee68ecfb8cd18#monotouch-test-release
[3]: https://gist.github.com/rolfbjarne/0181ab8abe436c34cf4ee68ecfb8cd18#minimal-xi-app-debug
[4]: https://gist.github.com/rolfbjarne/0181ab8abe436c34cf4ee68ecfb8cd18#minimal-xi-app-release
2018-02-14 17:47:31 +01:00
Rolf Bjarne Kvinge a6106fb3a6 [monotouch-test] Second attempt to find protocols available everywhere. 2018-02-14 14:29:06 +01:00
Rolf Bjarne Kvinge 2afed0342c [monotouch-test] Use protocols available in all platforms in ProtocolTest. 2018-02-14 09:35:25 +01:00
Rolf Bjarne Kvinge 3c0ba1b86a [tests] Fix typo. 2018-02-14 09:19:00 +01:00
Rolf Bjarne Kvinge 9e9e479ab2 [monotouch-test] Adjust new test to not try to reference IMDLComponent on watchOS (where it doesn't exist). 2018-02-14 01:11:44 +01:00
Manuel de la Pena 7472c8237d
[Foundation] Add not bound NSDateComponentUndefined. Fixes 60740 (#3471)
Added the value and provided tests that show the API usage. Value was
inferred from the headers:

NSDateComponentUndefined = NSIntegerMax
2018-02-13 20:38:24 +01:00
Rolf Bjarne Kvinge 1de94d444b [static registrar] Create a table of interface -> protocol in the static registrar.
Create a table of interface -> protocol in the static registrar, since we need
to be able to look up a protocol given a managed type without looking at the
(possibly linked away) [Protocol] attribute.
2018-02-13 19:38:35 +01:00
Rolf Bjarne Kvinge 0af9a6744d [xharness] Add a new test variation for xammac tests: release with all optimizations enabled. 2018-02-13 19:38:34 +01:00
Manuel de la Pena d0037ddc42
[Tests] Ensure that tests do not fail due to the locale. Fixes #3445 (#3448) 2018-02-09 21:14:57 +01:00
Manuel de la Pena 62480fb0e2
[Metal] If the device is not supported, skip certain tests. Fixes #3389 (#3444)
* [Metal] If the device is not supported, skip certain tests. Fixes #3389
2018-02-09 18:21:22 +01:00
Alex Soto 5bf7f0c542
[SceneKit] Adds NullAllowed to ISCNSceneRenderer.OverlayScene (#3410) (#3423)
Fixes xamarin/xamarin-macios#3392

It seems swift has this property listed as an optional[0] and
an Apple sample[1] sets this to null so `ISCNSceneRenderer.OverlayScene`
needs to have `[NullAllowed]` even if ObjC headers do not have
nullability information.

[0]: https://developer.apple.com/documentation/scenekit/scnscenerenderer/1524051-overlayskscene
[1]: https://github.com/xamarin/xamarin-macios/issues/3392
2018-02-07 15:02:30 -06:00
Alex Soto 8dbd20000c
[SceneKit] Adds NullAllowed to ISCNSceneRenderer.OverlayScene (#3410)
Fixes xamarin/xamarin-macios#3392

It seems swift has this property listed as an optional[0] and
an Apple sample[1] sets this to null so `ISCNSceneRenderer.OverlayScene`
needs to have `[NullAllowed]` even if ObjC headers do not have
nullability information.

[0]: https://developer.apple.com/documentation/scenekit/scnscenerenderer/1524051-overlayskscene
[1]: https://github.com/xamarin/xamarin-macios/issues/3392
2018-02-07 12:36:41 -06:00
Rolf Bjarne Kvinge 1a260e542b
[tests] Build the native test library for macOS and create a binding project for it. (#3373)
* [tests] Build the native test library for macOS and create a binding project for it.

Also add the new binding project to the xammac and link all XM test projects,
which allows us to stop excluding tests that require the native library and
the corresponding bindings.

* [tests] Include more tests in xammac_tests.

* [tests] Correctly ignore the ObjC exception tests in release mode.
2018-02-02 11:14:44 +01:00
Vincent Dondain 4c25aa94bd
[arkit] Update for Xcode 9.3 beta 1 (#3343)
- Obsolete `ARFaceAnchor`'s default constructor because it's marked as unavailable.
- Obsolete `CreateFaceGeometry` in `ARSCNFaceGeometry` in favor of `Create` (same as `ARSCNPlaneGeometry`).
2018-01-30 17:09:16 -05:00
Vincent Dondain 5cc720ff37
[backport][arkit] Fix 'Vertices', 'TextureCoordinates' and 'TriangleIndices' in 'ARFaceGeometry' (#3090) (#3342)
- Fixes bug #61056: [ARKit] TriangleIndices, Vertices and TextureCoordinates should be respectively short [], Vector3 [] and Vector2 []
(https://bugzilla.xamarin.com/show_bug.cgi?id=61056)
- Obsolete `short TriangleIndices`.
- Obsolete `Vector3 Vertices`.
- Obsolete `Vector2 TextureCoordinates`.
- Introduced new `short [] GetTriangleIndices ()`.
- Introduced new `Vector3 [] GetVertices ()`.
- Introduced new `Vector2 [] GetTextureCoordinates ()`.
2018-01-29 11:07:52 -05:00
Alex Soto a6204f2aa5
[Security] Update to Xcode 9.3 Beta 1 (#3344)
* [Security] Update to Xcode 9.3 Beta 1

Api diff:
- https://github.com/xamarin/xamarin-macios/wiki/Security-iOS-xcode9.3-beta1
- https://github.com/xamarin/xamarin-macios/wiki/Security-tvOS-xcode9.3-beta1
- https://github.com/xamarin/xamarin-macios/wiki/Security-watchOS-xcode9.3-beta1
- https://github.com/xamarin/xamarin-macios/wiki/Security-macOS-xcode9.3-beta1

* Update the xtro files

* Add SecCopyErrorMessageString binding
2018-01-27 16:26:43 -06:00
Sebastien Pouliot fdc70c6526
[tests] Adjust monotouch-test so it does not crash/fail on simulator and devices running 11.3 (#3319)
* Only skip broken tests when using Xcode9.3 SDK
2018-01-26 11:17:46 -05:00
Sebastien Pouliot d6dcbbf37f
[tests][macos] RoundtripRSAMinPKCS1 public/GetPublicKey should be false on 10.13 (#3116) (#3297) 2018-01-25 09:01:32 -05:00
Sebastien Pouliot ca06526793
[tests][monotouch] Remove the ignore on MPVolumeView added in xcode9 beta 3 - it seems to work fine now (#3284) 2018-01-23 08:27:18 -05:00
Sebastien Pouliot f5df902049
[foundation] Add NSBundle.GetLocalizedString returning an NSString. Fixes #41292 (#3266)
The original, now obsoleted, `LocalizedString` API returned a .net
`string` which does not work in most cases.

Different versions of iOS seems to return different (public or internal)
subclasses of `NSString` that are understood by other API (like NSString
`localizedStringWithFormat:`) for further customization.

Our logic to convert NSString to string is correct but it cannot
recreate the custom, required subclass to continue the localization.

So the new API return an `NSString` publicly (which is actually a
subclass) that can do the required job.

Adding a test in monotouch-test is presently blocked by #3265 [2]

[1] https://bugzilla.xamarin.com/show_bug.cgi?id=41292
[2] https://github.com/xamarin/xamarin-macios/issues/3265

* Add tests for new (and old) NSBundle API and adjust old ones since adding a Base.lproj directories changes things

* Add localization to xammac_tests since it shares the same, updated tests
2018-01-20 14:00:01 -05:00
Sebastien Pouliot 431cad0311
[tests] Confirm a device/sim support Metal before running MetalPerformanceShaders tests. Fixes #3237 (#3268) (#3270)
https://github.com/xamarin/xamarin-macios/issues/3237
2018-01-19 16:45:04 -05:00
Sebastien Pouliot dc7b19ce15
[tests] Confirm a device/sim support Metal before running MetalPerformanceShaders tests. Fixes #3237 (#3268)
https://github.com/xamarin/xamarin-macios/issues/3237
2018-01-19 11:21:21 -05:00
Sebastien Pouliot 761a382f01
[macos][mediatoolbox] Add a macOS specific API for XM (#3220)
- added unit test (not much to test)
- xtro data updated
2018-01-16 08:42:11 -05:00
Sebastien Pouliot d1d4446060
[CoreGraphics] Fix issue with the MakeMutable in CGPath where ref count was leaking. (#3228) (#3231) 2018-01-16 08:40:40 -05:00
Manuel de la Pena a52748277d [CoreGraphics] Fix issue with the MakeMutable in CGPath where ref count was leaking. (#3228) 2018-01-15 16:35:05 -05:00
Sebastien Pouliot 1c3c899933
[foundation] Reduce duplication inside NSData.FromString methods (#3221)
and ensure the temporary `NSString` instance is disposed asap.

Found will debugging something else. Unit tests added to confirm there
is no behavior change when the API are used.
2018-01-15 09:08:17 -05:00
Alex Soto 879a61faa7
[SceneKit] Add AddAnimation overload that takes a SCNAnimation (#3192)
Fixes xamarin/xamarin-macios#3166

Apple broke `addAnimation:forKey:` API by changing `CAAnimation` parameter into a
`ISCNAnimationProtocol` that was introduced in Xcode 9 (iOS 11 and company).

We can't break the existing API but we can add an extension method that
reuses the `CAAnimation` overload but takes a `SCNAnimation` and we
turn the `SCNAnimation` into a `CAAnimation` behind the scenes.

For XAMCORE_4_0 we corrected the protocol signature to take `ISCNAnimationProtocol` so there won't be a need for the extension method anymore.
2018-01-12 09:11:46 -06:00
Sebastien Pouliot 07c24949c0
[tests][macos] Enable more tests to be executed on macOS (XM) (#3191)
Largely related to somewhat recent frameworks/API additions to XM

ExternalAccessory was added to macOS 10.13 (Xcode9) and can't be run before that (including on the jenkins sierra bots). Also enable that test on tvOS (which added support in Xcode8)
2018-01-10 20:58:49 -05:00
Sebastien Pouliot f9ceb5c39d
[metalperformanceshaders] Fix MPSImageLanczosScale base class change (#3170)
Sadly this creates a breaking change since the `ScaleTransform`
property was re-introduced with an incorrect signature in the new
base class `MPSImageScale`

Unless someone has an idea how to avoid it (I don't see an option)
then we'll have to document it in the 15.7 release notes.

Also add missing _SetScaleTransform call and related unit tests
2018-01-09 12:03:18 -05:00
Timothy Risi 6ad9014c9f [Xammac_tests] RoundtripRSAMinPKCS1 public/GetPublicKey should be false on 10.13 (#3116) 2017-12-22 10:29:59 -05:00
Sebastien Pouliot 48530bcd8d
[tests][security] Update TrustTest to run faster (without timeouts) (#3108)
The original test was to cover both X509Certificate and X509Certiicate2
when using with SecTrust. However the code diverged over time. That and
the different certificates used caused the `*2` tests to hit a time
loop (designed to reduce incorrect errors randomly reported).

We want to keep the "delay" logic for it's intended purpose - but it
should not be needed normally.

The tests have been refactored to reuse the same logic (between both
types of certificates) which solve this (when used with the same
certificates)

Replace https://github.com/xamarin/xamarin-macios/pull/3068
2017-12-18 11:14:31 -05:00
Manuel de la Pena cb688be5c4
[CoreAnimation] Ensure that we increase the handle refenrece count in MakeMutable. Fixes #3089 (#3099)
* [CoreAnimation] Ensure that we increate the handle referene in MakeMutable. Fixes 3089

Fixes https://github.com/xamarin/xamarin-macios/issues/3089
2017-12-15 16:13:42 +01:00
Vincent Dondain 8899158260
[arkit] Fix 'Vertices', 'TextureCoordinates' and 'TriangleIndices' in 'ARFaceGeometry' (#3090)
- Fixes bug #61056: [ARKit] TriangleIndices, Vertices and TextureCoordinates should be respectively short [], Vector3 [] and Vector2 []
(https://bugzilla.xamarin.com/show_bug.cgi?id=61056)
- Obsolete `short TriangleIndices`.
- Obsolete `Vector3 Vertices`.
- Obsolete `Vector2 TextureCoordinates`.
- Introduced new `short [] GetTriangleIndices ()`.
- Introduced new `Vector3 [] GetVertices ()`.
- Introduced new `Vector2 [] GetTextureCoordinates ()`.
2017-12-12 12:33:48 -05:00
Vincent Dondain 18378d752e Fix merge mistake in monotouch-test.csproj 2017-12-06 15:18:11 -05:00
Vincent Dondain d7b7a6ea02 Merge branch 'xcode9.2' 2017-12-06 14:41:13 -05:00
Chris Hamons 4c966e3e71 Fix macOS 10.13 test failures (#3066) 2017-12-03 19:45:28 -05:00
Rolf Bjarne Kvinge 113e518d9d
[monotouch-test] Update permission checks. (#3071)
Apparently iOS 11 shows system dialogs for more API, so sprinkle permission
checks in more places.
2017-12-01 17:46:47 +01:00
Manuel de la Pena 6135a6c4d8
[MSBuild] Do not set CFBundleDevelopmentRegion if not present. (#2779)
* [MSBuild] Do not set CFBundleDevelopmentRegion if not present.

This is a complicated fix. This is a regression introduced by Apple.
CFLocaleCopyCurrent(), used in the iOS code, will return the value of
the application's CFBundleDevelopmentRegion Info.plist key if all of the
following conditions are true:

* CFBundleDevelopmentRegion is present in the Info.plist
* The CFBundleDevelopmentRegion language is in the list of preferred
languages on the iOS device, but isn't the first one
* There are no localized resources (i.e. no .lproj directory) in the app
for the first preferred locale

This differs from iOS 10 where the presence of the
CFBundleDevelopmentRegion key had no effect.

Note that if the CFBundleDevelopmentRegion key is not present at all,
CFLocaleCopyCurrent() always returns the first preferred locale as it
did in iOS 10.

We are adding the key by default in the plist of the applications which confuses users since they do not see the key in the .plist added by the template. This commit removes it to be more explicit and help users understand the behaviour.
2017-12-01 16:52:25 +01:00
Rolf Bjarne Kvinge 10c5bc10a9
[monotouch-test] Update permission checks. (#3067)
Apparently iOS 11 shows system dialogs for more API, so sprinkle permission
checks in more places.
2017-11-30 17:54:02 +01:00
Sebastien Pouliot e4cbbda64f
[tests] Disable CoreText/FontDescriptorTest on tvOS. Fixes #58929 (#3061)
Since tvOS 11 there's not a single font, on that platform, that
has the ligatures that the test verified.

Test remains enabled for other platforms.

reference:
https://bugzilla.xamarin.com/show_bug.cgi?id=58929
2017-11-29 09:10:25 -05:00
Alex Soto 74d2dcadfb
[tests] Fix introspection tests for macOS (#3054)
* [tests] Fix introspection tests for macOS

It seems that apple forgot to ship SSLSetALPNProtocols and SSLCopyALPNProtocols in macOS
there are already radars filled about this https://bugs.swift.org/browse/SR-6131
So this test will fail once Apple fixes this issue. when this happens we need to do two things, reenable
the API and reenable the [Get|Set]AlpnProtocols tests, the one insides 'StreamDefaults' for the mac.

* Implement feedback
2017-11-28 17:27:20 -06:00
Timothy Risi 87f9e23989 [MetalPerformanceShaders] Xcode 9 bindings (#3005)
* [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816)

* [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938)

The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10

* Remove some [Model] attributes that sholdn't be needed

* Fix introspection test crashes

* More introspection fixes

* NN does not need to be PascalCased

Remove unneeded Models and BaseTypes

* PR Whitespace fixes and renamings

* Paste fail

* More fixes from PR comments

* [MPS] Adds new intro test, fixes ctors and xtro output

* Removes duplicated availability attributes.
* Removes obsoleted API from macOS since mps is new to it.
* Fixes xtro output.
* Adds missing API.
* Fixes parameterless ctors, some of them do not really work, found
  by our new intro test and disabled the one that seem to not make
  sense due to the presence of DesignatedInitializers.
* Fixes a selector typo.
* Adds new `ShouldNotExposeDefaultCtorTest` to intro.

ShouldNotExposeDefaultCtorTest
==============================

This test checks for types with a parameterless ctor that are subclasses
of `NSObject` and then cheks if the BaseType of said objects also expose
a parameterless ctor (all in .NET land), if this is not the case it reports
them and so they can manually audited. Also this test has the ability to
print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can
take this code into an Xcode project and easily tests the ctors.

It seems that xtro (sharpie) does not have a complete picture of when a ctor
must be exposed hence the hability to generate this code and manually test.

Right now this test is just enabled for MPS since it is the scope of this PR.
In the future it should be enabled for all other frameworks and the output be
manually audited.

* [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback.

https://bugzilla.xamarin.com/show_bug.cgi?id=59547

* Fixes premature collection possible in bindings im MPSKernel.cs
* Fixes MPSImageHistogramTest from using deprecated API.
* Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest.

* [MPS] Reenable Copy API and DesignatedInitializer xtro feedback

* Implement more feedback

* More feedback
2017-11-28 14:29:05 -06:00
Sebastien Pouliot 4ad96b03fa
[security] Add bindings for Xcode 9 (#3043)
Also covers the missing enum value (added in xcode9) from
https://bugzilla.xamarin.com/show_bug.cgi?id=59278
2017-11-26 09:53:04 -05:00
Sebastien Pouliot f0915df335
[coreimage] Fix the pointer used in CIVector(nfloat[]) until the native call completes (#3038)
However there's a small window between the time we get a pointer
and the call to the native selector where the memory is not fixed.
During this time the GC can move the memory resulting in hard to
diagnose crashes.

Note: `initWithValues:count:` copies the provided memory so what
happens afterward is not an issue.
2017-11-24 09:55:11 -05:00
Sebastien Pouliot 9b7c33e9ca
[photos] Fix incorrect SDPHLivePhotoFrameProcessingBlock. Fixes #58227 (#3011)
The correct signature is a `ref NSError`, the bound API was missing the
`ref` and this required adding support to the generator.

Generated code diff:
https://gist.github.com/spouliot/3cdc7f8a40fe67a962ed9fefc2411d60

Bug: https://bugzilla.xamarin.com/show_bug.cgi?id=58227
2017-11-22 14:42:20 -05:00
Vincent Dondain 30a057ddc0
[CoreImage] Update filters for Xcode 9 (#2974)
- Fixes bug #57350: Review new CoreImage filters added in Xcode 9
(https://bugzilla.xamarin.com/show_bug.cgi?id=57350).
- Adds `AVCameraCalibrationData` and `CIBarcodeDescriptor` to `generator-filters`.
- Fixes `ApiCoreImageFiltersTest`'s `GenerateBinding` to use valid `[CoreImageFilterProperty]`.
- In `CheckManagedFilters` generate code of SuperClass when detected so it's easier to bind.
2017-11-16 16:38:14 -05:00
Rolf Bjarne Kvinge 171cf4987c
[monotouch-test] Tweak CalendarTest yet again. (#3015)
Hopefully third time's the charm...

Don't do date math (adding hours) to a local datetime, since DST *will* muddy
the waters and prove that 1=2.

Instead convert the date we want to calculate on to UTC, which should be DST-agnostic.

I've tested this by running the test for every hour during the next 10 years,
so that should cover mostly everything (although I'm still waiting for the
Delorean I ordered to be able to test both in the future and the past).

Previous attempts:

0442cdf9c0
5caddb3571

Should fix https://github.com/xamarin/maccore/issues/573.
2017-11-16 18:48:37 +01:00
Sebastien Pouliot f4fc3d0be0
[monotouch-test] Fix ContactStoreTest for watchOS (#3006)
Backport/merge of PR #306 to avoid random failures on bots.
Should fix https://github.com/xamarin/maccore/issues/577
2017-11-14 16:10:19 -05:00
Vincent Dondain 311fe265f8
[storekit] Fix SKCloudServiceSetupOptions strong dictionary's 'Action' (#2998)
- Fixes bug #59928: SKCloudServiceSetupViewController.LoadAsync() does not work correctly when passed an SKCloudServiceSetupOptions object instead of a manually-created NSDictionary
(https://bugzilla.xamarin.com/show_bug.cgi?id=59928)
2017-11-14 10:12:58 -05:00
Sebastien Pouliot 526160d12d [tests] Fix XM build for monotouch/xammac-tests 2017-11-07 22:45:31 -05:00
Sebastien Pouliot f702512483 [tests] Handle a 2nd case where ContactStoreTest.GetUnifiedContacts can fail on bots 2017-11-07 20:52:35 -05:00
Sebastien Pouliot e68acf1caa [tests] Handle possible access denied in ContactStoreTest.GetUnifiedContacts
For some reason this happens with the watchOS 4.2 simulator on our
Jenkins bots (but not locally for me).

The test is updated to ignore errors as depending on the sim default
content does not seems possible.
2017-11-07 15:35:10 -05:00
Sebastien Pouliot 93118069ee [tests] Fix monotouch-tests to execute without failure with xcode 9.2 beta 2 2017-11-07 14:48:16 -05:00
Rolf Bjarne Kvinge 5caddb3571
[monotouch-test] Fix regression in CalendarTest to not compare UTC and local time directly. (#2964)
In 0442cdf9c0 the `now` variable was changed to
be a UTC date, but unfortunately the code that compares it to a local date
(NSDate.Now) wasn't updated.

Only year/month/day values were compared, which meant the test would fail if
run when UTC and local time didn't represent the same date (and conversely
would pass if the UTC and local date was the same date, which is why the
changed did not fail the PR test run: the PR was tested during the 19 hours of
the day when EST and UTC represent the sam date).

Fix this by converting the UTC `now` to NSDate instead of using NSDate.Now.

This has the additional benefit of also fixing a (much smaller) race
condition: if midnight occurred just between calculating `now` and NSDate.Now,
the test would also fail.
2017-11-07 16:12:00 +01:00
Rolf Bjarne Kvinge 82e3aaf278
[monotouch-test] Move generated files out of the "all test files" wildcard. (#2958)
monotouch-test has a wildcard to automatically include new test files, but
this should not include generated files, because:

* The generated files are generated when needed, which means we can't rely on
  the wildcard to trigger their generation, because the wildcard won't find
  them before they exist, and as such msbuild won't detect that they're
  needed.
* This means the generated files must be listed separately, but in that case
  they shouldn't be found by the wildcard too, because that leads to:

    /Library/Frameworks/Mono.framework/Versions/5.4.0/lib/mono/msbuild/15.0/bin/Roslyn/Microsoft.CSharp.Core.targets(84,5): error MSB3105: The item "ObjCRuntime/TrampolineTest.generated.cs" was specified more than once in the "Sources" parameter.  Duplicate items are not supported by the "Sources" parameter.

So move the generated files to a different directory, so that the wildcard
doesn't find them.
2017-11-06 17:16:32 +01:00
Rolf Bjarne Kvinge 0442cdf9c0
[monotouch-test] Tweak CalendarTest to work when 1h = 2h due to DST change. (#2957)
At 2:00 AM on November 5h 2017, winter came to our bots in Boston.

This meant that between 2:00 and 3:00 AM, subtracting 1h from the current
time yielded a time difference of 2h.

This was caught by our observant tests:

    [FAIL] CalendarTest.DateComponentsTest :   b hour
        Expected: 1
        But was:  2

To avoid such issues next time this test happens to run during this single
hour of the entire year that causes problems, change the test to use time
calculcation using UTC instead.
2017-11-06 15:17:12 +01:00
Rolf Bjarne Kvinge acbfb063c5
[monotouch-test] Fix MDLVoxelArrayTest to allow for different index extents. (#2956)
This test fails on the bots:

	[FAIL] MDLVoxelArrayTest.BoundingBoxTest :   MaxX (M)
  Expected: -1.0f
  But was:  0.0f

For some unknown reason I'm not able to reproduce locally, but the actual
values look normal, so update the test to accept those as well.
2017-11-06 15:16:37 +01:00
Sebastien Pouliot 8baa15f6c3 [tests] Adjust new tests to build on XM too 2017-11-03 15:30:04 -04:00
Sebastien Pouliot 395feca0d9 Merge branch 'xcode9.1' into master-merge-xcode91-take2 2017-11-03 10:30:07 -04:00
Sebastien Pouliot 03b9d1759e
[security] Add RequestSharedWebCredential overload. Fixes #60423 (#2940)
* The original API was incorrect. Lack of documentation at binding time?
* Use a strong dictionary to expose the credentials

The fixed version cannot be unit tested since it popups an UI.

The test case attached to the bug report [1] can be used to verify it.

reference:
[1] https://bugzilla.xamarin.com/show_bug.cgi?id=60423
2017-11-02 14:54:39 -04:00
Sebastien Pouliot 5239f2528a Merge branch 'xcode9.1' into d15-5-xcode9.1 2017-10-31 23:31:00 -04:00
Sebastien Pouliot 16214f305b Revert "[MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816)"
This reverts commit 531bafcfaa.
2017-10-31 17:17:54 -04:00
Timothy Risi 2926a13f7e
[test] Change monotouch-test and xammac_tests to use all .cs files in monotouch-test/ Fixes #60290 (#2930)
Exclude the registrar/trampoline generated files from xammac_tests
Remove CoreLocation.LocationTest since is covered by introspection
2017-10-31 08:09:21 -08:00
Rolf Bjarne Kvinge 33f8b8bc8f
[monotouch-test] CGColorSpace.CreateIccData is iOS 10+ only. (#2936) 2017-10-30 18:05:41 +01:00
Rolf Bjarne Kvinge 64c3ea2cae [monotouch-test] Fix 2 issues when running on iOS 9. (#2934)
* [monotouch-test][GameplayKit] GKAgent3D isn't available on iOS 9.

Fixes this test failure:

> [FAIL] GKAgent3DTest.RotationTest : ObjCRuntime.RuntimeException : Wrapper type 'GameplayKit.GKAgent3D' is missing its native ObjectiveC class 'GKAgent3D'.

* [monotouch-test][MPS] MPSImageHistogram.HistogramSizeForSourceFormat doesn't seem to work on iOS 9.

Calling MPSImageHistogram.HistogramSizeForSourceFormat seems to abort on iOS 9
due to invalid arguments no matter which pixel format I use:

> /BuildRoot/Library/Caches/com.apple.xbs/Sources/MetalImage/MetalImage-39.3/MetalImage/Filters/MIHistogram.mm:103: failed assertion `[MPSImageHistogram histogramSizeForSourceFormat:] unsupported texture format: 114'

So only call this method on iOS 10+.
2017-10-27 17:06:02 -04:00