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

[ObjC] The assembly mscorlib.dll was not found in Embedinated Umbrella Framework iOS used by Swift #558

Open emysa341 opened 6 years ago

emysa341 commented 6 years ago

I have a C# project, after embedination I get a nicely wrapped Objective-C framework. If I consume this project in any iOS application (Objective-C/Swift) works fine. If I try to consume this objective-c based framework nested inside a swift based framework -> Then in client application it results into dll not found errors:

Error-Highlights-> The assembly mscorlib.dll was not found or could not be loaded.

Test Suite 'Selected tests' started at 2017-12-15 14:25:22.837 Test Suite 'ConsumerTests.xctest' started at 2017-12-15 14:25:22.838 Test Suite 'ConsumerTests' started at 2017-12-15 14:25:22.838 Test Case '-[ConsumerTests.ConsumerTests testForTestingUmrellaFramework]' started. 2017-12-15 14:25:22.846091+0100 xctest[13921:651806] The assembly mscorlib.dll was not found or could not be loaded. 2017-12-15 14:25:22.846237+0100 xctest[13921:651806] **It should have been installed in the /Users/builder/data/lanes/5665/6857dfcc/source/xamarin-macios/builds/install/simulator64/lib/mono/2.1/mscorlib.dll directory.** Program ended with exit code: 1

So I embedinated a csharp project to objective-C framework "CSharp.framework" and then I use "CSharp.framework" in swift based framework named "Consumer.framework" then I use "Consumer.framework" in Consumer.Tests then it fails with above errors and Its not a project configuration problem its embedination problem. Because I also created same project structure without embedination everything works fine but after embedination these dll problems arise. To Reproduce the issue, open consumer project and run the test with name "testForTestingUmrellaFramework".

After running the test now I get different dll errors:

Error-Highlight-> Library not loaded: rpath/libxamarin.dylib, Referenced from libCSharp.dylib

2017-12-15 15:25:00.374771+0100 xctest[15351:798149] The bundle “ConsumerTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. 2017-12-15 15:25:00.375526+0100 xctest[15351:798149] (dlopen_preflight(/Users/xamarindev/Library/Developer/Xcode/DerivedData/Consumer-higzelgkqqwzakbnjwdlroihgdil/Build/Products/Debug-iphonesimulator/ConsumerTests.xctest/ConsumerTests): Library not loaded: @rpath/libxamarin.dylib **Referenced from: /Users/xamarindev/Library/Developer/Xcode/DerivedData/Consumer-higzelgkqqwzakbnjwdlroihgdil/Build/Products/Debug-iphonesimulator/Consumer.framework/Frameworks/libCSharp.dylib** Reason: image not found) Program ended with exit code: 82

Conclusion : If embedinated framework or libary is used in Umbrella frameworks (Nested frameworks) then it results into dll not found errors. Following are enclosures:

chamons commented 6 years ago

This gets into more swift / iOS than I know, but at first look appears to be some sort of packaging issue (?)