mono / Embeddinator-4000

Tools to turn .NET libraries into native libraries that can be consumed on Android, iOS, Mac, Linux and other platforms.
MIT License
758 stars 95 forks source link

TypeLoadException when Embeddinator encounters tuples #680

Open jnajerasc opened 6 years ago

jnajerasc commented 6 years ago

Steps to Reproduce

  1. Upgrade to latest Alpha stream for Visual Studio for Mac for this issue https://github.com/mono/Embeddinator-4000/issues/670
  2. In VS for Mac, successfully build C# project that contains a method signature with tuple, such as
    public MyResultSet<(string name, string value)> GetInfo()
  3. Reference this built dll with Embeddinator's objcgen, and get the exception in the objcgen build log.

Expected Behavior

No exception related to use of tuple

Actual Behavior

The exception is given:

EM0000: Unexpected error - Please fill a bug report at https://github.com/mono/Embeddinator-4000/issues
System.TypeLoadException: Type 'System.ValueTuple`2' not found in assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Environment

// I don't have objcgen in the /Library/Frameworks/ directory; it was installed to my local .nuget folder, as per instructions at https://docs.microsoft.com/en-us/xamarin/tools/dotnet-embedding/get-started/install/install
$ ~/.nuget/packages/embeddinator-4000/0.4.0/tools/objcgen -version
Symbol file /Users/me/.nuget/packages/embeddinator-4000/0.4.0/tools/IKVM.Reflection.pdb doesn't match image /Users/me/.nuget/packages/embeddinator-4000/0.4.0/tools/IKVM.Reflection.dll
Embeddinator-4000 v0.1 (0.4: 7664197)

// Info from About Visual Studio
=== Visual Studio Professional 2017 for Mac (Preview) ===

Version 7.6 Preview (7.6 build 1773)
Installation UUID: 43c9d72f-5bec-4be6-89eb-04ec0671c540
Runtime:
    Mono 5.12.0.273 (2018-02/f59eac4c0f1) (64-bit)
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

    Package version: 512000273

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    2.1.0
    2.0.5
    2.0.4
SDK: /usr/local/share/dotnet/sdk/2.1.300/Sdks
SDK Versions:
    2.1.300
    2.1.4
    2.1.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.12.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.3
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 9.4.1 (14161)
Build 9F2000

=== Xamarin.Mac ===

Version: 4.6.0.4 (Visual Studio Professional)
Hash: 29d671b5
Branch: master
Build date: 2018-06-07 11:51:32-0400

=== Xamarin.iOS ===

Version: 11.14.0.4 (Visual Studio Professional)
Hash: 29d671b5
Branch: d15-8
Build date: 2018-06-07 11:51:32-0400

=== Xamarin.Android ===

Not Installed

=== Xamarin Inspector ===

Version: 1.4.0
Hash: b3f92f9
Branch: master
Build date: Fri, 19 Jan 2018 22:00:34 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 706001773
Git revision: e5958ff9015312c81fc3b1b6b6413585575ca869
Build date: 2018-06-19 12:19:27+00
Build branch: release-7.6
Xamarin extensions: 6910f36b43e7d559ff40ae268e73ae26c30a2a6b

=== Operating System ===

Mac OS X 10.13.5
Darwin 17.6.0 Darwin Kernel Version 17.6.0
    Tue May  8 15:22:16 PDT 2018
    root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

Internet of Things (IoT) development (Preview) 7.5

Build Logs

objcgen_build_log.txt

dalexsoto commented 6 years ago

Unfortunately I don't think we currently support exposing tuples to Objective-C land, I would suggest to create a DTO/POCO and expose it instead.

jcapellman commented 6 years ago

If the tuples are used within a dependency would that work? Or if it were made private within the library?