No code changes or configuration, build succeeds in VSForMac 8.1.
Build fails in the latest 8.2 version that contains new version of Xamarin.iOS and Mono.
Build fails in the latest preview of 8.3 with the same errors.
The app use ApplePay, so in code we have usage of PKPaymentAuthorizationViewController from PassKit.
Actually, there are no special steps to reproduce the issue:
Though the project is successfully built for a simulator, it fails for the device:
Normal execution on simulator.
Build succeeds for device.
Runtime error on simulator.
Build fails for device.
Visual Studio Community 2019 for Mac
Visual Studio Community 2019 for Mac
Version 8.2 (build 1105)
Installation UUID: 3ea14265-a699-41ea-a136-b39d75b9620b
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 5.14.0.85 (d16-2-fix-mac-updates / 86973979)
Package version: 600000311
Mono Framework MDK
Runtime:
Mono 6.0.0.311 (2019-02/494641b300c) (64-bit)
Package version: 600000311
NuGet
Version: 5.1.0.6013
.NET Core
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.1.12
2.1.11
2.1.9
2.1.8
2.1.7
SDK: /usr/local/share/dotnet/sdk/2.1.701/Sdks
SDK Versions:
2.1.701
2.1.700
2.1.505
2.1.504
2.1.503
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.0.0/lib/mono/msbuild/Current/bin/Sdks
Xamarin.Profiler
Version: 1.6.11
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Updater
Version: 11
Xamarin.Android
Version: 9.4.0.51 (Visual Studio Community)
Commit: xamarin-android/d16-2/9fa7775
Android SDK: /Users/aserdobintsev/Library/Android/sdk
Supported Android versions:
6.0 (API level 23)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.1
SDK Build Tools Version: 28.0.3
Build Information:
Mono: mono/mono/2019-02@e6f5369c2d2
Java.Interop: xamarin/java.interop/d16-2@d64ada5
LibZipSharp: grendello/LibZipSharp/d16-2@caa0c74
LibZip: nih-at/libzip/rel-1-5-1@b95cf3f
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-2@6f6c969
Microsoft Mobile OpenJDK
Java SDK: /Users/aserdobintsev/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
Android Device Manager
Version: 1.2.0.58
Hash: d03e3ea
Branch: remotes/origin/d16-2~1
Build date: 2019-07-16 17:37:14 UTC
Xamarin Inspector
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1
Apple Developer Tools
Xcode 10.3 (14492.2)
Build 10G8
Xamarin.Mac
Version: 5.14.0.110 (Visual Studio Community)
Hash: a8bcecce
Branch: d16-2
Build date: 2019-06-28 07:31:43-0400
Xamarin.iOS
Version: 12.14.0.110 (Visual Studio Community)
Hash: a8bcecce
Branch: d16-2
Build date: 2019-06-28 07:31:42-0400
Xamarin Designer
Version: 16.2.0.354
Hash: 5f80a14f8
Branch: remotes/origin/d16-2
Build date: 2019-07-11 17:28:26 UTC
Build Information
Release ID: 802001105
Git revision: a187f6852ae62ba52b944b47e53702957edfcf7b
Build date: 2019-07-22 18:20:10+00
Build branch: release-8.2
Xamarin extensions: 34bd2378d8d707df25989727c23ce68d9a232a67
Operating System
Mac OS X 10.14.6
Darwin 18.7.0 Darwin Kernel Version 18.7.0
Thu Jun 20 18:42:21 PDT 2019
root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64
Console log of simulator
Xamarin.iOS: Established connection with the IDE (fd: 6)
[3180:20476] Xamarin.iOS: Processing: 'start profiler: no'
[3180:20396] Xamarin.iOS: Profiler not loaded (disabled)
[3180:20396] Xamarin.iOS: Added dllmap for objc_msgSend
[3180:20396] Could not register the assembly 'Xamarin.iOS': ObjCRuntime.RuntimeException: 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)'
at Registrar.Registrar.ComputeSignature (System.Type declaring_type, System.Boolean is_ctor, System.Type return_type, System.Type[] parameters, System.Reflection.MethodBase mi, Registrar.Registrar+ObjCMember member, System.Boolean isCategoryInstance, System.Boolean isBlockSignature) [0x0013d] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/Registrar.cs:2492
at Registrar.Registrar.ComputeSignature (System.Type DeclaringType, System.Reflection.MethodBase Method, Registrar.Registrar+ObjCMember member, System.Boolean isCategoryInstance, System.Boolean isBlockSignature) [0x00059] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/Registrar.cs:2449
at Registrar.Registrar+ObjCMethod.ComputeSignature () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/Registrar.cs:907
at Registrar.Registrar+ObjCMethod.get_Signature () [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/Registrar.cs:880
at Registrar.Registrar+ObjCMethod.get_Trampoline () [0x00153] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/Registrar.cs:852
at Registrar.DynamicRegistrar.RegisterMethod (Registrar.Registrar+ObjCMethod method) [0x0002e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/DynamicRegistrar.cs:995
at Registrar.DynamicRegistrar.OnRegisterType (Registrar.Registrar+ObjCType type) [0x00225] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/DynamicRegistrar.cs:877
at Registrar.Registrar.RegisterTypeUnsafe (System.Type type, System.Collections.Generic.List`1[System.Exception]& exceptions) [0x00f28] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/Registrar.cs:2369
at Registrar.Registrar.RegisterAssembly (System.Reflection.Assembly assembly) [0x00076] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/Registrar.cs:2407
[3180:20396] ObjCRuntime.RuntimeException: 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)'
at Registrar.Registrar.ComputeSignature (System.Type declaring_type, System.Boolean is_ctor, System.Type return_type, System.Type[] parameters, System.Reflection.MethodBase mi, Registrar.Registrar+ObjCMember member, System.Boolean isCategoryInstance, System.Boolean isBlockSignature) [0x0013d] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/Registrar.cs:2492
at Registrar.Registrar.ComputeSignature (System.Type DeclaringType, System.Reflection.MethodBase Method, Registrar.Registrar+ObjCMember member, System.Boolean isCategoryInstance, System.Boolean isBlockSignature) [0x00059] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/Registrar.cs:2449
at Registrar.Registrar+ObjCMethod.ComputeSignature () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/Registrar.cs:907
at Registrar.Registrar+ObjCMethod.ValidateSignature (System.Collections.Generic.List`1[System.Exception]& exceptions) [0x00017] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/ObjCRuntime/Registrar.cs:895
Build errors when device selected as a target
/Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/PassKit/PKPaymentAuthorizationViewControllerDelegate.g.cs(0,0): Error MT4136: The registrar cannot marshal the parameter type 'PassKit.PKPaymentAuthorizationViewController' of the parameter 'controller' in the method 'PassKit.IPKPaymentAuthorizationViewControllerDelegate.DidSelectShippingAddress(PassKit.IPKPaymentAuthorizationViewControllerDelegate,PassKit.PKPaymentAuthorizationViewController,AddressBook.ABRecord,PassKit.PKPaymentShippingAddressSelected)' (MT4136)
/Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/PassKit/PKPaymentAuthorizationViewController.g.cs(0,0): 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)' (MT4136)
I can reproduce this.
Can you try add this anywhere in your Main method:
Console.WriteLine (new AddressBook.ABGroup ());
this works as a workaround for me.
@rolfbjarne Thanks, I'll try it on Monday.
There is another workaround - just comment all usages of PassKit and PKPaymentAuthorizationViewController. It also helps.
@rolfbjarne instantiating of the ABGroup have helped to fix build error.
+1 for the ABGroup
Most helpful comment
Can you try add this anywhere in your Main method:
this works as a workaround for me.