Embeddinator-4000 icon indicating copy to clipboard operation
Embeddinator-4000 copied to clipboard

Embeddinator(objcgen) fails if target C# library includes a 3rd party Binding Nuget (Naxam braintree)

Open emysa341 opened this issue 5 years ago • 4 comments

I have a project setup where I have two target class library projects

  • MyTargetProjectAndroid
  • MyTargetProjectiOS Both of them contains nuget package Naxam.Paypal.OneTouch Android and Naxam.Paypal.OnTouch iOS. In droid there is no error during Embeddinating. But on iOS Embeddination fails with error aot.aotdata file not FileNotFoundException. Even if I reference another project and move the nuget braintree dependency there it still fails.

Steps to Reproduce

  1. Perform Embeddination(objcgen) on a C# class library with Naxam.Paypal.OneTouch nuget package installed

Expected Behavior

Embeddination shouldn't fail.

Actual Behavior

Embeddinator fails with error MyTargetAssembly.aotdata.arm64 FileNotFoundException.

Environment

Visual studio for mac Version 8.0.4
Xamarin.iOS, Version 12.8.0.0, Branch d16-0.
Mono framework 5.18.1.3
Embeddinator-4000, Version Master branch

Build Logs

warning MT0127: Incremental builds have been disabled because this version of Xamarin.iOS does not support incremental builds in projects that include more than one third-party binding libraries.
error MT0000: Unexpected error - Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new
System.IO.FileNotFoundException: OutputPath/iPhoneOS/build-cache/arm64/HeagTicketingServiceIos.aotdata.arm64 does not exist
File name: 'OutputPath/iPhoneOS/build-cache/arm64/HeagTicketingServiceIos.aotdata.arm64'
  at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111 
  at Xamarin.Bundler.Application.CopyFile (System.String source, System.String target) [0x00052] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/common/Application.cs:419 
  at Xamarin.Bundler.Application.UpdateFile (System.String source, System.String target, System.Boolean check_contents) [0x00011] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/common/Application.cs:336 
  at Xamarin.Bundler.Assembly.CopyAotDataFilesToDirectory (System.String directory) [0x00040] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Assembly.cs:226 
  at Xamarin.Bundler.Application.BundleAssemblies () [0x001ff] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:2211 
  at Xamarin.Bundler.Application.BuildEnd () [0x00016] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:907 
  at Xamarin.Bundler.Application+<>c.<BuildAll>b__144_3 (Xamarin.Bundler.Application v) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:830 
  at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x0001e] in <b4d1a66727f44ba888b54966284fabb4>:0 
  at Xamarin.Bundler.Application.BuildAll () [0x000a3] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:830 
  at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x0042f] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/mtouch.cs:1331 
  at Xamarin.Bundler.Driver.Main (System.String[] args) [0x00015] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/mtouch.cs:856 

Example Project (If Possible)

emysa341 avatar Apr 25 '19 09:04 emysa341

Can you attach a project? I tried adding that nuget to an iOS class library project and it refused to add it:

For adding package 'Naxam.BrainTree.BrowserSwitch.Droid.0.1.4' to project 'Class' that targets 'xamarinios10'.
Install failed. Rolling back...
Package 'Naxam.BrainTree.BrowserSwitch.Droid.0.1.4' does not exist in project 'Class'
Package 'Naxam.BrainTree.BrowserSwitch.Droid.0.1.4' does not exist in folder '/Users/donblas/Projects/Class/packages'
Executing nuget actions took 352.85 ms
Could not install package 'Naxam.BrainTree.BrowserSwitch.Droid 0.1.4'. You are trying to install this package into a project that targets 'Xamarin.iOS,Version=v1.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

chamons avatar Apr 26 '19 21:04 chamons

@chamons The one you added is for android, please use Naxam.PayPalOneTouch.iOS

emysa341 avatar May 07 '19 05:05 emysa341

I was able to create a XI library with Naxam.PayPalOneTouch.iOS and run objcgen on it.

Please attach a project showing the specific problem.

chamons avatar May 22 '19 18:05 chamons

Here is the sample project to download. The zip file contains following

  • Framework -> Output of Embeddinator
  • Objcgen -> executables
  • PerformEmbeddination -> Command to start embeddination (Run after build in VS project properties)
  • TestNaxamBrainTree -> Project to be embeddinated, it contains BrainTreePaymentProvider class, if you uncomment the classes used from Braintree error goes away. The project I am working gave me a different error since downgraded and upgraded Xamarin.iOS but this sample also interesting as it give architecture errors.

To reproduce the error simply open the project in VS and build/Rebuild the library project TestNaxamBrainTree.

emysa341 avatar May 24 '19 15:05 emysa341