1

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

Mr. 笑哥
  • 283
  • 1
  • 5
  • 15
  • Well, it's an alpha version, so it would be possible. But wouldn't it make more sense to go to the Github page and open an issue there? – Gerald Versluis Nov 14 '17 at 07:39
  • It might be an issue with linking... I have Akavache alpha running on release version ios apps with no issues right now. 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 – Shane Neuville Nov 14 '17 at 15:55
  • @GeraldVersluis that's what I'm thinking. As for going to GitHub, well, I can't be too certain if it's a bug, so I'd first like to attempt stackoverflow and see if anyone else faced the same problem. Once I've ascertained that it is indeed a bug, then GitHub it is. – Mr. 笑哥 Nov 15 '17 at 00:17
  • @ShaneNeuville alright buddy, I'm going to try that. I do have a linker as follow: Anyway, I will attempt adding the override. Cheers. – Mr. 笑哥 Nov 15 '17 at 00:18
  • @ShaneNeuville this has certainly helped. Thank you very much. Would appreciate if you could post it as a response so that I can accept as an answer. In the interim, I have posted below so that anyone who comes across can get it resolved. Awaiting your feedback Shane – Mr. 笑哥 Nov 15 '17 at 01:21

1 Answers1

4

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

Shane Neuville
  • 2,127
  • 14
  • 19