praeclarum / sqlite-net

Simple, powerful, cross-platform SQLite client and ORM for .NET
MIT License
4.03k stars 1.42k forks source link

Using sqlite-net-base with SQLitePCLRaw.provider.winsqlite3 #1247

Closed Cincidial closed 2 months ago

Cincidial commented 2 months ago

Hello,

After many hours trying to get the base library (no provider or bundle included) - version 1.9.172 - to work on with winsqlite3 I discovered that the version of SQLitePCLRaw.Core that this is referencing is preventing the use of the most recent winsqlite3 library (2.1.8). The 1.9.172 version of sqlite-net-base is using SQLitePCLRaw.Core version 2.1.2 and the most recent winsqlite 3 is using 2.1.8. Since only one version is being copied to the output bin it's taking the most recent one, which is provided by winsqlite 3, which is throwing an assembly not found error with sqlite-net-base as it cannot find the 2.1.2 version.

I understand that it is recommended to use sqlite-net-pcl for ease of use. However, after spending a few days trying to get that to work and being stumped by endless e_sqlite3.dll not found errors. Even with the dll sitting in the bin folder available for use after building for a specific CPU type. I decided to try an approach where I could specify the provider, and thus the dll.

My solution to this was to downgrade winsqlite 3 to 2.1.2 as it also uses core version 2.1.2. This has fixed the problem. I'm wondering if this is the intended way to be using the library, or is sqlite-net-base currently using the incorrect version of core? Or is there something else going wrong?

Other info:

ericsink commented 2 months ago

I understand that it is recommended to use sqlite-net-pcl for ease of use.

That depends on who you ask. I always recommend sqlite-net-base.

an assembly not found error with sqlite-net-base as it cannot find the 2.1.2 version

This surprises me. I wouldn't expect that to happen, and at the moment, I'm not sure why it would.

endless e_sqlite3.dll not found errors .NET 4.8 Any CPU...

You're in the trickiest configuration. Lots of weird cases happen with .NET Framework (as opposed to .NET Core and its modern descendants). Any AnyCPU is even more troublesome.

Cincidial commented 2 months ago

I'm surprised on the assembly not found error as well, I would expect it to be okay with a newer version. I would grab the stack trace and actual error report, but I didn't save them, and I've got it working now so just going to leave it be.

Thanks for the response, issue was mostly just a long shot to see if there was a specific trick to using the net-base and winsqlite3 that I had missed. Hopefully this work-around can help other people stuck with a configuration like mine (can't change out of any CPU and 4.8 due to other requirements)