System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: 6489c5a396ea36eee8046716f7010348f3c8de59
Title: Problem with System.Data.SQLite.Linq in Entity Framework
Status: Closed Type: Code_Defect
Severity: Critical Priority: Immediate
Subsystem: Build_Automation Resolution: Fixed
Last Modified: 2013-01-01 19:31:32
Version Found In: 1.0.69.0 dotnet
Description:
I get this error when using Linq query to retrieve data from database with Entity Framework 4: 

Model1.ssdl(2,76) : error 0004: Could not load file or assembly 'System.Data.SQLite.Linq, Version=1.0.38.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

The 1.0.66.0 version of System.Data.Sqlite from sqlite.phxsoftware.com works without this error.

Steps to reproduce:

1) Install http://system.data.sqlite.org/sqlite-dotnet-x86-1006900.exe. Copy System.Data.SQLite.dll, System.Data.SQLite.Linq.dll, SQLite.Interop.dll to the program's bin folder, reference System.Data.SQLite.dll, System.Data.SQLite.Linq.dll within the project.

2) Project -> Add -> New Item -> Ado.NET Entity Model. Fill Model from database.

3) In the program's code run query :

using (var entity = new Entities())
{
var q = from customers in entity.Customers
                                where customers.ID == 1
                                select new { TerminatedCustomers = customers.Terminated };

var customer = q.First();
}

4) The program throws this error: 

A first chance exception of type 'System.Data.MetadataException' occurred in System.Data.Entity.dll 
Schema specified is not valid. Errors: 
Model1.ssdl(2,76) : error 0004: Could not load file or assembly 'System.Data.SQLite.Linq, Version=1.0.38.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
 
--------------------------------------------

Environment details:

OS: Windows 7 64 |
VS: Visual Studio 2010 Ultimate v. 10.0.30319.1 |
Target Framework: .NET Framework 4 Client Profile |
Platform Target: x86 |
System.Data.SqLite version: 1.0.69.0, runtime version: 2.0.50727, x86 build |
System.Data.SQLite.Linq: v. 1.0.69.0, runtime: v. 2.0.50727, x86 build |
System.Data.Entity: v. 4.0.0.0, runtime: v. 4.0.30319

<hr /><i>anonymous added on 2011-04-27 15:07:50 UTC:</i><br />
Hello,

I have the same issue with version 1.0.70.0.

<hr /><i>anonymous added on 2011-04-28 10:01:38 UTC:</i><br />
Same issue with build 1.0.71.0.

Thanks for your effort.

Regards

myCollections

<hr /><i>anonymous added on 2011-05-02 08:44:48 UTC:</i><br />
Same issue with 1.0.72.0.

Thanks

myCollections

<hr /><i>anonymous added on 2011-05-09 11:14:04 UTC:</i><br />
Please fix this bug. It's a real deal breaker. And it seems to be a simple version error. While the program, for some reason, expects v. 1.0.38.1 of System.Data.SQLite.Linq, the actual version is 1.0.69.0 (or later).

<hr /><i>anonymous added on 2011-05-10 09:36:07 UTC:</i><br />
For those who cannot wait till bug is fixed:

Download sources (v 1.0.72.0).

Go to sqlite-dotnetsrc-1007200\System.Data.SQLite\LINQ\SQLiteFactory_Linq.cs

Change version in line (from 1.0.38.1 to your version, e.g. 1.0.72.0):

        Type type = Type.GetType("System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite.Linq, Version=1.0.38.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139", false);

After that it will throw new exception complaining about ProviderManifest.xml (ticket 133daf50d6). GO TO THAT TICKET AND APPLY FIXES from its description too.
After that I've got system working.

<hr /><i>shane added on 2011-05-24 01:18:47 UTC:</i><br />
Fixed by [9ce4a2e044].