System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
2020-04-25
16:46
The core NuGet packages MUST include the pre-compiled binaries for the .NET Standard 2.1. Fix for [ad28d8e026] and [7c73262e6f]. check-in: e96e13ac75 user: mistachkin tags: trunk
2020-04-20
08:36 Ticket [ad28d8e026] System.Data.Entity.Core.ProviderIncompatibleException on netcore3 (using EF 6.3) status still Closed with 3 other changes artifact: b6725b71ac user: anonymous
2020-04-18
13:11 Ticket [ad28d8e026]: 3 changes artifact: 34f608d3b4 user: mistachkin
2020-04-16
12:44 Ticket [ad28d8e026]: 3 changes artifact: 3f07bad14e user: anonymous
2020-03-05
01:04 Closed ticket [ad28d8e026]. artifact: 6bae63c040 user: mistachkin
2019-12-08
04:02 Pending ticket [ad28d8e026]. artifact: 461810a625 user: mistachkin
04:01
Include the 'LINQ' partial classes in the primary managed assembly for .NET Standard 2.1. Fix for [ad28d8e026]. Also, enhancements to related diagnostic functionality, including the new 'SQLite_ForceLogLifecycle' environment variable. check-in: 6b6fb5374d user: mistachkin tags: trunk
03:29 Ticket [ad28d8e026] System.Data.Entity.Core.ProviderIncompatibleException on netcore3 (using EF 6.3) status still Verified with 4 other changes artifact: c14b91f573 user: mistachkin
2019-12-07
19:07 Verified ticket [ad28d8e026]. artifact: 52805c9f9d user: mistachkin
2019-12-06
12:04 Ticket [ad28d8e026]: 3 changes artifact: 448ec9625e user: anonymous
2019-10-30
18:28 Ticket [ad28d8e026]: 3 changes artifact: e764d49fdb user: anonymous
16:04 Ticket [ad28d8e026]: 3 changes artifact: 52b69d7a01 user: mistachkin
12:42 Ticket [ad28d8e026]: 3 changes artifact: 284f7a989c user: anonymous
08:41 Ticket [ad28d8e026]: 3 changes artifact: f664c091b1 user: anonymous
00:42 Ticket [ad28d8e026]: 6 changes artifact: a2f0c53f0b user: mistachkin
2019-10-29
17:18 New ticket [ad28d8e026]. artifact: 143997298d user: anonymous

Ticket Hash: ad28d8e026c4c2275547a58bac3fe426ead63faa
Title: System.Data.Entity.Core.ProviderIncompatibleException on netcore3 (using EF 6.3)
Status: Closed Type: Code_Defect
Severity: Important Priority: Medium
Subsystem: Connection Resolution: Fixed
Last Modified: 2020-04-20 08:36:50
Version Found In: 1.0.112
User Comments:
anonymous added on 2019-10-29 17:18:29:
When using dbContext.Database.ExecuteSqlCommand or dbContext.Database.SqlQuery<T> the call just fails with the following stacktrace.

The same code works when targeting net48 (instead of netcoreapp3.0) or when using 1.0.111 (and ignoring the NuGet-restore warnings).

System.Data.Entity.Core.ProviderIncompatibleException
  HResult=0x80131920
  Message=A null was returned after calling the 'get_ProviderFactory' method on a store provider instance of type 'System.Data.SQLite.SQLiteConnection'. The store provider might not be functioning correctly.
  Source=EntityFramework
  StackTrace:
   at System.Data.Entity.Core.Common.DbProviderServices.GetProviderFactory(DbConnection connection)
   at System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInvariantName(DbConnection connection)
   at System.Data.Entity.Internal.InternalConnection.get_ProviderName()
   at System.Data.Entity.Internal.LazyInternalContext.get_ProviderName()
   at System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext context)
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.InternalContext.Initialize()
   at System.Data.Entity.Internal.InternalContext.ExecuteSqlCommand(TransactionalBehavior transactionalBehavior, String sql, Object[] parameters)
   at System.Data.Entity.Database.ExecuteSqlCommand(TransactionalBehavior transactionalBehavior, String sql, Object[] parameters)
   at System.Data.Entity.Database.ExecuteSqlCommand(String sql, Object[] parameters)

mistachkin added on 2019-10-30 00:42:20:
Please try adding the following line of code to your application and see if
the issue is still present:

Environment.SetEnvironmentVariable("TypeName_SQLiteProviderServices",
"System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6, " +
"Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139");

anonymous added on 2019-10-30 08:41:44:
I'm sorry but this did not change anything -- still the very same error message.

anonymous added on 2019-10-30 12:42:14:
I attached a sample to reproduce the exception.

mistachkin added on 2019-10-30 16:04:24:
Thanks for the example.  I'll investigate this issue as soon as I can.

anonymous added on 2019-10-30 18:28:39:
Hello, OT here again (the one with the attachment at 2019-10-30 12:42:14 was a different person),

I wanted to note that years ago I got rid of all magic tokens inside app.config or .edmx files (meanwhile migrated to code first) by doing two things:

1) The class inheriting from DbContext only uses the ctor which passes in a read DbConnection instance. In my case this can be SQLServer or SQLite, determined at runtime by user settings.

2) There is one configuration class inside the same assembly inheriting from System.Data.Entity.DbConfiguration and doing the following inside the ctor:

	this.SetProviderFactory("System.Data.SQLite", System.Data.SQLite.SQLiteFactory.Instance);
	var providerServices = GetService<System.Data.Entity.Core.Common.DbProviderServices>(System.Data.SQLite.EF6.SQLiteProviderFactory.Instance);
	Debug.Assert(providerServices != null, "providerServices != null");
			this.SetProviderServices("System.Data.SQLite", providerServices);

Why and how this works I figured out using Reflection years ago. Might be outdated.

anonymous added on 2019-12-06 12:04:48:

Still same problem with netcore3.1 + EF 6.4.

Is this already fixed for 113 (or will there be a patch release)?


mistachkin added on 2019-12-08 03:29:02:

I've determined the root cause of this issue. The System.Data.SQLite assembly built for .NET Standard 2.1 is missing the two partial class files from the "LINQ" sub-directory, due to incorrect conditional compilation.

This issue will be fixed for the 1.0.113.0 release.


mistachkin added on 2019-12-08 04:02:27:

Fixed on trunk via check-in [6b6fb5374d].


anonymous added on 2020-04-16 12:44:55:

In which 1.0.112.1 nuget packge are these missing partials? or should be?


mistachkin added on 2020-04-18 13:11:18:

The issue should be resolved in the 1.0.112.1 NuGet packages.


anonymous added on 2020-04-20 08:36:50:

Which 1.0.112.1 one? .EF6, .LINQ, .Core, .MSIL? There is no "System.Data.SQLite 1.0.112.1" at all.