-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[.Net Framework 4.8]Library e_sqlite3 not found #19396
Comments
@dyoalie I have not been able to reproduce this. Please post a small, runnable project that reproduces the behavior you are seeing. |
EF Team Triage: Closing this issue as the requested additional details have not been provided and we have been unable to reproduce it. BTW this is a canned response and may have info or details that do not directly apply to this particular issue. While we'd like to spend the time to uniquely address every incoming issue, we get a lot traffic on the EF projects and that is not practical. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we use canned responses for common triage decisions. |
I have the same bug described above. With same setup. |
G'day @ajcvickers I'm not the original submitter of this issue, but I think I'm running in to the same thing - except on net472. I've put together a very very simple project that reproduces the issue. Doesn't even need EFCore, just Microsoft.Data.Sqlite is sufficient to reproduce the issue. https://github.com/MatthewKing/Issue19396 Unless I'm doing something wrong? |
@MatthewKing Thanks! @bricelam This repros for me in Visual Studio when running tests. However, it works when using Rider to run the tests. Maybe the VS test runner isn't resolving the native path correctly? |
Possibly related to ericsink/SQLitePCL.raw#252 |
The workaround should be to add a reference to SQLitePCLRaw in the test project |
@bricelam Which package specifically? I added this, but no luck: <PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.2" /> |
That should've been enough. I'll have to dig into it. |
I'm experiencing this issue too. It may be helpful to note that I can use the PM Console to create/run migrations and everything works as expected. However when I attempt to run my code, the second I try to query for data it hangs for a second then times out and raises the exception. |
Duplicate #19893 reports this also for xUnit, so it's likely not test framework-specific. |
Also getting this for xUnit. Stack trace follows:
|
I have the same problem targeting net462 and using xunit 2.41. |
I've got the same issue running on .NET Framework v4.8 and xUnit Test Runner for Visual Studio v2.4.1: #19893 --- ngm |
I was able to duplicate this in a slightly different manner. I encountered the same exception, although it was a single .Net 4.7.2 Class library which references EFCoreSqlite. I set up a single test case, which when run throws the exception. The constructor in the test class just tries to create a new |
I have the same problem.
<TargetFramework>net48</TargetFramework>
public class UnitTest1
{
[Fact]
public void Test1()
{
var options = new DbContextOptionsBuilder().UseSqlite("DataSource=:memory:").Options;
using (var context = new MyContext(options))
{
context.MyEntities.ToList();
}
}
}
public class MyEntity
{
public int Id { get; set; }
public string Label { get; set; }
}
public class MyContext : DbContext
{
public MyContext(DbContextOptions options) : base(options)
{ }
public DbSet<MyEntity> MyEntities { get; set; }
}
But the test work with .NET Core runtime : <TargetFramework>netcoreapp3.1</TargetFramework> |
I'm getting this same error with .NET Framework 4.7.2. It is definitely a problem with the Visual Studio Test runner as identical code works fine when run as a regular application. I have added literally every sqlite package to the Test Project to no avail. Does anyone have any suggestions? |
I had similar trouble on a .Net Framework 4.7.2 console app with VS2022 on Windows 11 64-bit trying to get this code to run: I solved it by adding this line of code: |
@ericsink suggested a solution here: ericsink/SQLitePCL.raw#485 |
For me it works when explicit reference a newer version <PackageVersion Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.0" /> i think |
Verified that this is fixed with M.D.Sqlite 8.0.0 targeting net472. |
Nice, can you explain how to apply the fix? |
Install that latest package. |
…or xRunner ericsink/SQLitePCL.raw#485 (derived from this dotnet/efcore#19396)
I am facing this issue but not when runing my project in vs (c#, winforms and vs2022) but when I build a .exe using visual studio project installer 2022. After I install the app and run it the error appears. It is weird since there is no error message when building the .exe. I am using MS.EF.Core.Sqlite (8.0.6) and MS.EFCore (8.0.6) to manage the sqlite db. I create the dbcontext as follow:
I am using .NET8.0 |
@iSantPy What is "visual studio project installer 2022"? |
microsoft visual studio installer project: https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2022InstallerProjects it is used to build a .exe for windows. the runtimes folder is there and contains the directory runtimes\win-x86\native\e_sqlite3.dll with the file that is "missing". Reading with detail the message when building the .exe I notice this: maybe there could be the problem? I install the app and then I run it and the problem appers. But if I run it from vs it runs ok. I have not proved in other machine yet |
@iSantPy When the application is installed, the files are copied in a installation folder, generally in |
Sure! here are the screenshots: You talk about a bin folder that in my case it is not there after installing. Could be that a problem? |
If you execute "ControlAguaPotable.exe" by double clicking on, does the error occur? |
No, it runs ok but when I initialize the dbContext to read or write the db the errors appears: and only happens when I run the .exe from the installation folder. If I run the .exe from the output folder created by vs (debug or release) it runs ok and it reads and writes the db correctly. |
@iSantPy , Can you do a repos with a minimal reproducible example? |
A .Net Framework 4.8 program referencing a .Net Standard 2.0 using EFCore.Sqlite 3.1 can't simply run (on Any CPU/X64/X86) with an exception shown:
But the output folder does contain e_sqlite3.dll, which seems to be a bug.
To Reproduce
The text was updated successfully, but these errors were encountered: