-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Unable to load e_sqlite3.dll for Microsoft.EntityFrameworkCore.Sqlite 3.0.0 #84
Comments
Two questions:
|
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="1.1.6" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<None Update="northwind.sqlite3">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
|
Sorry, but I don't think there is anything I can do to fix this error. Under the hood, EF Core's SQLite provider uses https://github.com/ericsink/SQLitePCL.raw. The way SQLitePCLRaw.nativelibrary is attempting to load the "e_sqlite3.dll" library circumvents this essential callback in The root cause appears to be the use of WorkaroundChange your plugin deployment to include a runtime identifier. |
Hmmm. This is interesting. Thanks for tagging me in. Not sure yet what to do about it. |
Your workaround isn't a workaround... The native sqlite library needs to know which architecture to use. At least 32/64bit... Run into this with shared libraries for xamarin - It's normal, not a bug. If you need further help, tell me @ericsink |
You're right. Depending on your scenario, publishing the plugin using By the way @ericsink, it seems like we've run into the "native" version of this "managed" problem: https://github.com/dotnet/coreclr/blob/v3.0.0/Documentation/design-docs/AssemblyLoadContext.ContextualReflection.md#problem. Basically, the API used by SQLite isn't aware of the context it is called from. I think we should request a feature in coreclr to make System.Runtime.InteropServices.NativeLibrary honor the current assembly loading context. |
Hmmm. That's good info. I'm getting a better understanding of the problem here. |
Any updates on this? Dead in the water on it currently. |
No significant update yet, but let's link this issue too: ericsink/SQLitePCL.raw#343 |
I believe this will be addressed in .NET 5 - see dotnet/runtime#13819. I'm closing as there is no action item here for this library. The problem is external to my code and something I can't fix in older versions of .NET. |
Hi guys, I was also facing the same issue. I found the solution and it's working perfectly for me. If you ask I can write a detail note on the solution. |
Yes please.... |
I found its solution and it worked for me. Solution:First, I Removed all possible SQLite NuGet packages and then installed only one library(Nuget package) i.e "sqlite-net-pcl"( There are a number of different SQLite packages available – be sure to choose the correct one, it might not be the top result in search.) in all relevant project. It will download all its dependent packages. Please see below screenshot: Background:There are two visual studio solutions; one is for Android and the other one is for iOS, and there are three projects in every solution. Two projects(used as libraries) are common for android and iOS solutions. In one common project, There is some SQLite code to handle database operations. So in this project, I installed the "sqlite-net-pcl" Nuget Package to fulfill the compile-time dependency. Root cause analysis:When I run the app, I found there is run time exception(Library e_sqlite3 not found. I concluded that the SQLite library is needed at run time in the Android project. So I added the same "sqlite-net-pcl" Nuget Package in the Android project as well. This package downloads all its relevant dependent packages. And this worked perfectly for me. I hope it should work for everyone. Thank you for your patience to read the entire solution. |
Hi! |
Yes, his solution of manually copying the e_sqlite3.dll worked for me (I don't like it either) |
I had a windows form project running in .Net 6.0. When I upgraded it directly to .Net 8.0.8, there was no problem working in debug, but when I published the application and installed it through setup, I encountered this error. After trying many solutions, I finally changed the .Net version to 7.0 and the problem was solved. Then when I downgraded to .Net 8.0.8 again, I didn't get the same error again. I guess upgrading suddenly causes some deficiencies in such version transitions. |
Describe the bug
DllNotFoundException
thrown when using a plugin that consumesMicrosoft.EntityFrameworkCore.Sqlite 3.0.0
. If I downgrade EFCore.Sqlite to 2.2.6, the plugin works fine.To Reproduce
Steps to reproduce the behavior:
Version: 0.3.1
Code (In the main program):
The plugin connects to a Sqlite3 database with
Microsoft.EntityFrameworkCore.Sqlite 3.0.0
and print data toConsole
. (See the screenshot for details)Expected behavior
The plugin should not throw
DllNotFoundException
.Screenshots
Additional context
If I copy "e_sqlite3.dll" from "plugins\runtimes\win-x64\native\e_sqlite3.dll" to the "plugins" directory, the plugin won't throw DllNotFoundException.
The text was updated successfully, but these errors were encountered: