Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.TypeInitializationException when used in conjunction with Couchbase.Lite #368

Open
aphex3k opened this issue Aug 9, 2017 · 3 comments

Comments

@aphex3k
Copy link

aphex3k commented Aug 9, 2017

Akavache (5.0.0) is throwing a TypeInitializationException (see iOS 10.3.1 stacktrace attached).

The inner exception is a TypeLoadException pointing to SQLitePCL.
{System.TypeLoadException: VTable setup of type SQLitePCL.SQLite3Provider_internal failed at Akavache.Sqlite3.Internal.SQLiteConnection..cctor () [0x00000] in C:\projects\akavache\src\Akavache.Sqlite3\SQLite.cs:224 }

I think it is a conflict in SQLite when using in the same project with Couchbase.Lite(-PCL, v1.4.0) which also relies on SQLitePCLRaw.

I tried solving this by upgrading all SQLitePCLRaw packages to version 1.1.8 via Nuget and it in deed seems to fix the initialization exception at least but then fails to get objects with a hard crash (no exception captured).

I hesitated to report this issue here first because the underlying cause seems to be in SQLite. But maybe Akavache is also not using it correctly or there is an entirely separate issue with Akavache in tandem with SQLitePCLRaw 1.1.8...

Please let me know if you need more information. Unfortunately i have not been able to run this on Android yet.

@ericsink
Copy link
Contributor

ericsink commented Sep 4, 2017

You posted this weeks ago, so I figure you've probably already made progress, but anyway...

I don't think Couchbase Lite is compatible with 1.x versions of SQLitePCL.raw. The Couchbase Lite .NET repo is probably the best place to get specific help on using their library alongside something else (like Akavache) that uses newer versions of SQLitePCL.raw.

@aphex3k
Copy link
Author

aphex3k commented Sep 5, 2017

I moved on by removing couch base and akavache both and use SQLite.net-PCL directly...

@jessejiang0214
Copy link

I fixed this issue by these steps.
Update akavache to 5.0.0
Update sqlite-net-pcl to 1.4.118
Update all SQLitePCLRaw.* to 1.1.10

Call

            SQLitePCL.Batteries_V2.Init();
            SQLitePCL.raw.FreezeProvider()

At the beginning of each platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants