Closed ericsink closed 4 years ago
My own comment from the other issue: "At first glance, this looks like a bug in SQLitePCLRaw. A bug that is specific to .NET Framework. I need to look more closely."
I was able to reproduce this problem.
First I simply grabbed the repro projects, and run the Wpf project. It works fine.
Then if I change the akavache and SQLitePCLRaw versions as you specify, and run the project, I get the error shown above.
I began to wonder what else is going on, because it seemed like if akavache with SQLitePCLRaw 2.0 is so broken, everybody would be screaming.
So I looked for other things about this repro app that were different.
The Fody Costura stuff was the obvious suspect.
If I remove those things from the csproj and run the app again, it works fine.
I have this issue too. I can't use sqlite-pcl with SQLitePCLRaw 2.0
@Microlife-JasonLi Please post complete details of your situation in a new issue.
@Microlife-JasonLi use this drop in replacement for akavache. The problem really lives in akavache, not sqlitepcl. I had the problem at Airbus and rewrote akavache in 2 hours, then thoroughly tested it. All crash gone...
FWIW, if there is a problem with Akavache and SQLitePCLRaw, I would like to understand it in depth and find a solution rather than simply suggest alternatives to Akavache.
@ericsink there is a locking problem of sql queries. The db is not multithread safe. Even if it advertises to be so. Simple C# lock() statement are not enough (like akavache is using). lock statements don't work when using Tasks, because of the way Tasks are scheduled on threads (tasks != threads).
@softlion Akavache.SQLite3 delegates all database queries / inserts to a single thread, which means that it doesn't need locks
@softlion Akavache.SQLite3 delegates all database queries / inserts to a single thread, which means that it doesn't need locks
If that was really working I would still use it. But it does not.
Not sure if this is related or not, but after upgrading
Akavache
fromv6.5.20
tov6.7.1
andSQLitePCLRaw.bundle_e_sqlite3
fromv1.1.14
tov2.0.0
when trying to initialize Akavache I get the following exception:The exception is thrown from here: https://github.com/worldbeater/Camelotia/blob/misc-updates/src/Camelotia.Presentation.Wpf/App.xaml.cs#L24 Planning to investigate what's causing this later, but any ideas of what could go wrong with Akavache are appreciated. The repro is here,
misc-updates
branch,Camelotia.Presentation.Wpf
project. Akavache initializes without exceptions and works fine when targeting .NET Core (Camelotia.Presentation.Avalonia
) or UWP (Camelotia.Presentation.Uwp
), breaks only when targeting .NET Framework (WPF)Originally posted by @worldbeater in https://github.com/ericsink/SQLitePCL.raw/issues/282#issuecomment-520226926