sqlite-net
sqlite-net copied to clipboard
Exception: Library e_sqlite3 not found
After instaling the NuGet into a .NetFramework 4.8 WPF Desktop App I always receive the following excveption when I try to establish the DB connection ?
at SQLitePCL.NativeLibrary.Load(String libraryName, Assembly assy, Int32 flags) at SQLitePCL.Batteries_V2.MakeDynamic(String name, Int32 flags) at SQLitePCL.Batteries_V2.DoDynamic_cdecl(String name, Int32 flags) at SQLite.SQLiteConnection..cctor()
The type initializer for 'SQLite.SQLiteConnection' threw an exception.
The funny thing is that the DLL is located in the bin folder but for some reason not recognized - what could be the reason - is this not compatible with .NetFramework48 ?
_System.TypeInitializationException HResult=0x80131534 Message=The type initializer for 'SQLite.SQLiteConnection' threw an exception. Source=SQLite-net StackTrace: at SQLite.SQLiteConnection..ctor(String databasePath, Boolean storeDateTimeAsTicks) at Procam.Gdm.DatabaseService.DatabaseConnection.GetDbConnection() in \Dev-ASYNC\DatabaseService\DatabaseConnection.cs:line 44
This exception was originally thrown at this call stack: [External Code]
Inner Exception 1: Exception: Library e_sqlite3 not found_
So the framework is definitely not an issue as 4.6 to 4.8 is supporting .NetStandard2.0, the DLL is there but not recognized, I will check the sources of this thing...
OK I found the issue . the problem is that the Nuget ishould install the e_sqlite3.dll to the folders:
but when using a .NetFramwork4.8 project this is not done for whatever reason, seems to be a major issue between Core and .NetFramework.
After generating this folders manually it works fine ;)
It doesn't look like you've mentioned what version of sqlite-net or SQLitePCLRaw you are using.
I'm guessing you are building with AnyCPU. I think the problem with the targets file may be something I fixed in this pre-release:
2.0.8-pre20220111224339
If you add PackageReference of SQLitePCLRaw.bundle_green at the above version, it should override the one brought in by sqlite-net and would probably fix the issue.
Dear Erik. Thanks for your assistance. Yes, I am using AnyCPU. I will try the mentioned fix as first tomorrow and give you feedback. BR Markus
From: Eric Sink @.> Sent: Donnerstag, 17. Februar 2022 15:06 To: praeclarum/sqlite-net @.> Cc: Markus Albrecht @.>; Author @.> Subject: Re: [praeclarum/sqlite-net] Exception: Library e_sqlite3 not found (Issue #1099)
It doesn't look like you've mentioned what version of sqlite-net or SQLitePCLRaw you are using.
I'm guessing you are building with AnyCPU. I think the problem with the targets file may be something I fixed in this pre-release:
2.0.8-pre20220111224339
If you add PackageReference of SQLitePCLRaw.bundle_green at the above version, it should override the one brought in by sqlite-net and would probably fix the issue.
— Reply to this email directly, view it on GitHubhttps://github.com/praeclarum/sqlite-net/issues/1099#issuecomment-1042984553, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANSI6PYB3HGZRQTRZBJAJG3U3T6DRANCNFSM5OT4IOLQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.@.>>
BTW I am using NuGet version 1.8.116 ;)
Using the the prerelease solved the issue:
Greets!
Markus
Using the the prerelease solved the issue:
Greets! Markus
I don't understand how to repair it. Can I copy it?
I can also confirm using 1.9.141-beta fixed the issue. Alternatively reverting to 1.6.292 also fixed the issue.