System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: 0a236b580a3a1008b763dd996bb44572a27f5730
Title: .NET SQLite >1.0.66.0 is (still) not working on x86
Status: Closed Type: Code_Defect
Severity: Important Priority: Blocker
Subsystem: Integration_Via_PInvoke Resolution: Rejected
Last Modified: 2012-01-19 01:06:12
Version Found In: 1.0.77.0
Description:
I'm currently working on a .NET 4.0 project using the Entity Framework which is mapped to a SQLite database, which will be loaded by a path given by the user.

The ADO.NET Data Provider was working without any problems until I've tested it on a x86 machine. The application crashes everytime I try to read/load the database from my EntityModel with an BadImageException or and DllNotFound-Exception which is pointing to the SQLite.Interop.dll.

What I've tried so far:
- Changed the project platform from "Any CPU" to "x86" ==> See above
- Changed the references everytime I deployed my application from my x64 developing machine to the x86 DLLs "System.Data.SQLite.dll" and "System.Data.SQLite.Linq.dll"
- Downloaded the Source, compiled it as "x86" ==> DllNotFound-Exception or BadImageException
- Changed the Environment-Variable %PATH% and added the applications folder to it to provide .NET another safe place to find the DLL ==> DllNotFound-Exception
- Tried the .NET 3.5 DLLs ==> Unable to load the DLL due it's version conflict ==> Fixed it by adding "useLegacyV2RuntimeActivationPolicy" to my app.config ( see below ) ==> Still the same exceptions
- Tried the precompiled mixed binaries for .NET 3.5 and .NET 4.0 ==> DllNotFound-Exception
- Precompiled statically-linked binaries ==> Again, no luck


I also tried downloading the DLLs from somewhere else, unfortunately, no luck again. To me it seems like the mixed binaries still "require" ( DllImport ) the SQLite.Interop.dll even when you download the non-static precompiled binaries. Various combinations of the points listed above also couldn't fix the problem.

Every tutorial on "how to deploy an application using Entity Framework with the SQLite-Connector" was based on the 1.0.66.0 or 1.0.65.0 version - it was my last desperate idea before I was finally giving up deploying to x86: The application was working fine when using the 2 years old 1.0.66.0 DLLs originally from phxsoftware.


Seriously: Why!? I spent 3 days trying to get this crappy application working on x86, tried almost everything I could imagine of and I fixed it by using an "ancient" DLL which works very well without any Interop.dll-Crap on both x86 and x64 !?!?!?!

Am I missing something or am I too stupid to run the same application with different target DLLs ( the x86 ) on my netbook !?

Even the sample x86 applications are still crashing when using the "newer" and "better" DLLs, except the phxsoftware-sample with it's 1.0.66.0 DLL.

What the... !?


My app.config looks like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" />
  </startup>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite" />
      <add name="SQLite Data Provider" invariant="System.Data.SQLite"
           description=".Net Framework Data Provider for SQLite"
           type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>
</configuration>


Please fix this major issue as soon as possible, so I can start moving back to 1.0.7X.0 to benefit from the new "improvements".

If you need some sample code or the InnerExceptions, just run the samples or tell me, I can provide them.

Best regards,
cH40z-Lord

<hr /><i>mistachkin added on 2012-01-19 01:06:12 UTC:</i><br />
The BadImageFormatException means you are using the 32-bit interop DLL in a 64-bit process on a 64-bit machine.  The CLR does not support that configuration.  Please download the 64-bit package for the .NET Framework 4.0, <a href="https://system.data.sqlite.org/sqlite-netFx40-binary-x64-2010-1.0.77.0.zip">here</a>