-
Notifications
You must be signed in to change notification settings - Fork 110
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
TypeLoad exception on .NET Framework 4.7.2 #612
Comments
If I change my setup to explicitly use the <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.32" />
+ <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="3.1.32" />
+ <PackageReference Include="SQLitePCLRaw.lib.e_sqlite3" Version="2.1.10" />
+ <PackageReference Include="SQLitePCLRaw.provider.e_sqlite3" Version="2.1.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>
</Project> [Fact]
public void Create_database()
{
+ raw.SetProvider(new SQLite3Provider_e_sqlite3());
using (var context = new MyContext())
{
context.Database.EnsureCreated();
}
} Now the error is:
I can see that
|
PPS: it works when I also specify the RID in my csproj, but I don't know why. <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
+ <RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="3.1.32" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3" Version="2.1.10" />
<PackageReference Include="SQLitePCLRaw.provider.e_sqlite3" Version="2.1.10" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>
</Project> So, this works, but at this point I have strong doubts if what I'm doing is within the intended usage patterns. |
Hi,
I'm having problems getting SQLitePCL to work in an older application which targets .NET Framework 4.7.2. Attempting to use
SqliteConnection
always throwsSystem.TypeInitializationException
from its constructor. The error seems to vary based on what bundle I use. Example error:Repro steps
Create
sqlitebug.csproj
with content:Create
UnitTest1.cs
with content:Open a command prompt and run
dotnet test
.Other info
What version of SQLitePCLRaw are you using?
bundle: SQLitePCLRaw.bundle_e_sqlite3
version: 2.1.2
(This is a transitive dependency of
Microsoft.EntityFrameworkCore.Sqlite
.)What platform are you running on? What operating system? Which version? What CPU?
Are you using the command line, or an IDE? Which IDE? Which version of that IDE?
PS: I noticed the bundle uses a different provider for .NET Framework applications. Is that intended?
https://www.nuget.org/packages/SQLitePCLRaw.bundle_e_sqlite3/
The text was updated successfully, but these errors were encountered: