TypeLoadException when loading Android F# Libraries
SpiegelSoft opened this issue · comments
If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.
Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.
Bug Information
Version Number of Plugin: 4.0.0.13
Device Tested On: Samsung G925F (Android 7.0 API 24)
Simulator Tested On:
Version of VS: 15.7.2
Version of Xamarin: 4.10.0.448
Versions of other things you are using:
Steps to reproduce the Behavior
Create an F# Android class library
Package it up as a NuGet package
Create an F# Android application and reference the generated NuGet package
Run the F# Android application.
Expected Behavior
The Android app should launch
Actual Behavior
On launch, the app crashes with the message
System.TypeLoadException: Could not resolve type with token 01000078 (from typeref, class/assembly Plugin.DeviceInfo.Abstractions.IDeviceInfo, Plugin.DeviceInfo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null) occurred
Code snippet
Screenshotst
Some sample output:
05-25 01:22:40.986 D/Mono (16336): Assembly Ref addref Enceladus.Mobile.Consumer.Android[0xd6c55f20] -> Xamarin.Forms.Core[0xc059a680]: 4
05-25 01:22:40.986 D/Mono (16336): Assembly Ref addref Enceladus.Mobile.Consumer.Android[0xd6c55f20] -> XamarinForms.Reactive.FSharp[0xc059ace0]: 4
05-25 01:22:40.986 D/Mono (16336): Assembly Ref addref Enceladus.Mobile.Consumer.Android[0xd6c55f20] -> Enceladus.Core[0xc0eca920]: 4
05-25 01:22:40.986 D/Mono (16336): Assembly Ref addref Enceladus.Mobile.Consumer.Common[0xd6c55fe0] -> FSharp.Core[0xc0ecafe0]: 5
05-25 01:22:40.987 D/Mono (16336): Assembly Ref addref Enceladus.Mobile.Consumer.Common[0xd6c55fe0] -> Xamarin.Forms.Core[0xc059a680]: 5
05-25 01:22:40.987 D/Mono (16336): Assembly Ref addref Enceladus.Mobile.Consumer.Common[0xd6c55fe0] -> XamarinForms.Reactive.FSharp[0xc059ace0]: 5
05-25 01:22:40.987 D/Mono (16336): Assembly Ref addref Enceladus.Mobile.Consumer.Common[0xd6c55fe0] -> Enceladus.Core[0xc0eca920]: 5
05-25 01:22:40.987 D/Mono (16336): Assembly Ref addref Enceladus.Mobile.Consumer.Android[0xd6c55f20] -> ReactiveUI[0xc05991e0]: 3
05-25 01:22:41.003 D/Mono (16336): Assembly Ref addref Enceladus.Mobile.Consumer.Common[0xd6c55fe0] -> netstandard[0xbddc9660]: 5
05-25 01:22:41.018 D/Mono (16336): Assembly Loader probing location: '/storage/emulated/0/Android/data/com.piktical.faceid/files/.override/Plugin.DeviceInfo.dll'.
05-25 01:22:41.020 D/Mono (16336): AOT: image '/storage/emulated/0/Android/data/com.piktical.faceid/files/.override/Plugin.DeviceInfo.dll.so' not found: dlopen failed: library "/data/app/com.piktical.faceid-1/lib/arm/libaot-Plugin.DeviceInfo.dll.so" not found
05-25 01:22:41.021 D/Mono (16336): AOT: image '/usr/local/lib/mono/aot-cache/arm/Plugin.DeviceInfo.dll.so' not found: dlopen failed: library "/data/app/com.piktical.faceid-1/lib/arm/libaot-Plugin.DeviceInfo.dll.so" not found
05-25 01:22:41.021 D/Mono (16336): Assembly Ref addref Enceladus.Mobile.Android[0xd6c55f80] -> Plugin.DeviceInfo[0xc0599000]: 2
Unhandled Exception:
System.TypeLoadException: Could not resolve type with token 01000078 (from typeref, class/assembly Plugin.DeviceInfo.Abstractions.IDeviceInfo, Plugin.DeviceInfo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)
This was solved by providing an implementation of MainApplication
with the Application
attribute applied.