Possible bug in Akavache in Xamarin.Forms / Xamarin iOS

会有一股神秘感。 提交于 2019-12-24 07:29:52

问题


Implementation of Akavache works on Android debug and release and iOS debug mode. However, it crashes on iOS release mode.

The exception thrown, intercepted from Raygun, is The type initializer for 'Akavache.Sqlite3.Internal.SQLiteConnection' threw an exception.

Simply deploy iOS release mode and get prompted with the exception. Appreciate if anyone who had experienced similar issue could help.

Akavache version is 6.0.0-alpha0038.

Full stack trace as follow:

Akavache.Sqlite3.SQLitePersistentBlobCache..ctor(System.String databaseFile, System.Reactive.Concurrency.IScheduler scheduler) in :0 Akavache.Sqlite3.Registrations+<>c__DisplayClass0_0.b__2() in :0

Akavache.Sqlite3.Registrations+<>c__DisplayClass0_0.b__3() in :0 Splat.ModernDependencyResolver.GetService(System.Type serviceType, System.String contract) in <412cf7afb8e84872aee33a6b0acc7f20#a572ceb4cff14caae1629fe17a67dfc3>:0 Splat.DependencyResolverMixins.GetService[T](Splat.IDependencyResolver This, System.String contract) in <412cf7afb8e84872aee33a6b0acc7f20#a572ceb4cff14caae1629fe17a67dfc3>:0 Akavache.BlobCache.get_UserAccount() in <6b3110b6f37348ddb9bd9456cdb85f61#a572ceb4cff14caae1629fe17a67dfc3>:0 XXX.UI.CompositionRoot.CreateBlobCache() in <2815cf10ecb04f8fa012a0a005f4202e#a572ceb4cff14caae1629fe17a67dfc3>:0

XXX.UI.CompositionRoot.CreateApp() in <2815cf10ecb04f8fa012a0a005f4202e#a572ceb4cff14caae1629fe17a67dfc3>:0 XXX.UI.CompositionRoot.LoggedCreation[T](System.Func`1[TResult] factory) in <2815cf10ecb04f8fa012a0a005f4202e#a572ceb4cff14caae1629fe17a67dfc3>:0 XXX.UI.CompositionRoot.CreateApp() in <2815cf10ecb04f8fa012a0a005f4202e#a572ceb4cff14caae1629fe17a67dfc3>:0

XXX.UI.CompositionRoot.ResolveApp() in <2815cf10ecb04f8fa012a0a005f4202e#a572ceb4cff14caae1629fe17a67dfc3>:0 XXX.UI.iOS.AppDelegate.ResolveApplication(XXX.UI.CompositionRoot compositionRoot) in :0 XXX.UI.iOS.AppDelegate.FinishedLaunching(UIKit.UIApplication app, Foundation.NSDictionary options) in :0 UIKit.UIApplication.Main(System.String[] args, System.IntPtr principal, System.IntPtr delegate) in :0 UIKit.UIApplication.Main(System.String[] args, System.String principalClassName, System.String delegateClassName) in :0 XXX.UI.iOS.Application.Main(System.String[] args) in :0


回答1:


It might be an issue with linking...

Can you try link skipping the Akavache Dlls?

Or using a linker file to exclude them and see if that works?

Also make sure you have the https://github.com/PureWeen/Akavache/blob/3bd03246a6e198bde5eb93a54646dd9f25fc15a1/src/Akavache.Sqlite3/content/AkavacheSqliteLinkerOverride.cs.pp

file in your platform project

the main problem with iOS is that the Xamarin tools use static analysis to remove dlls that it doesn't think any of your code references. Akavache uses Reflection to find if you are using the SqlLite Dll which Xamarin can't detect so with release versions that DLL gets removed :-/

The Override class just gives the tools information that you want that Dll



来源:https://stackoverflow.com/questions/47279254/possible-bug-in-akavache-in-xamarin-forms-xamarin-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!