Re: [sqlite] System.Data.Sqlite problem
And don't you wish Microsoft and other's could spit out intelligent error messages like: "64-bit application trying to load 32-bit DLL". I ding my students whey do stupid stuff like: FILE *fp=fopen(filename,"r"); if (fp == NULL) { fprintf(stderr,"Cannot open file\n"); } Instead of if (fp == NULL) { perror(filename); } Which actually tells you what the problem is, permissions, not existing, etc It would be so simple for the DLL manager to be able to do this. But it's the same as Microsoft's old error message of "Cannot load dll". To which I always screamed "what DLL and why not" You're just seeing the new version of it. Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Joe Mistachkin [sql...@mistachkin.com] Sent: Friday, July 22, 2011 10:31 AM To: 'General Discussion of SQLite Database' Subject: EXT :Re: [sqlite] System.Data.Sqlite problem Jack Hughes wrote: > > The 64 bit version works like a charm but the 32 bit version unfortunately does not. The error > message given by test.exe is given at the end of the message. The BadImageFormatException might > suggest a bad download... so I've re-downloaded a number of times and the result with the 32 bit > version is always the same. > This is the expected behavior, let me explain why. First off, I'm going to assume you downloaded the non-mixed-mode packages. They both include a native "SQLite.Interop.dll" (for the appropriate processor architecture) that contains the SQLite core. They also include a pure managed "System.Data.SQLite.dll" (marked as "pure IL" in the CLR header). When any .NET application marked as "pure IL" runs on 64-bit Windows, it will run as a 64-bit process. Similarly, if you run that exact same application on 32-bit Windows, it will run as a 32-bit process. A 64-bit process cannot load a 32-bit DLL. Therefore, the "test.exe" program starts as a 64-bit process and then attempts to load the 32-bit "SQLite.Interop.dll", which raises the BadImageFormatException. -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.Data.Sqlite problem
ok Joe that's a relief. Thanks for your help, much appreciated. -Jack -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Joe Mistachkin Sent: 22 July 2011 16:32 To: 'General Discussion of SQLite Database' Subject: Re: [sqlite] System.Data.Sqlite problem Jack Hughes wrote: > > The 64 bit version works like a charm but the 32 bit version unfortunately does not. The error > message given by test.exe is given at the end of the message. The BadImageFormatException might > suggest a bad download... so I've re-downloaded a number of times and the result with the 32 bit > version is always the same. > This is the expected behavior, let me explain why. First off, I'm going to assume you downloaded the non-mixed-mode packages. They both include a native "SQLite.Interop.dll" (for the appropriate processor architecture) that contains the SQLite core. They also include a pure managed "System.Data.SQLite.dll" (marked as "pure IL" in the CLR header). When any .NET application marked as "pure IL" runs on 64-bit Windows, it will run as a 64-bit process. Similarly, if you run that exact same application on 32-bit Windows, it will run as a 32-bit process. A 64-bit process cannot load a 32-bit DLL. Therefore, the "test.exe" program starts as a 64-bit process and then attempts to load the 32-bit "SQLite.Interop.dll", which raises the BadImageFormatException. -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.Data.Sqlite problem
Jack Hughes wrote: > > The 64 bit version works like a charm but the 32 bit version unfortunately does not. The error > message given by test.exe is given at the end of the message. The BadImageFormatException might > suggest a bad download... so I've re-downloaded a number of times and the result with the 32 bit > version is always the same. > This is the expected behavior, let me explain why. First off, I'm going to assume you downloaded the non-mixed-mode packages. They both include a native "SQLite.Interop.dll" (for the appropriate processor architecture) that contains the SQLite core. They also include a pure managed "System.Data.SQLite.dll" (marked as "pure IL" in the CLR header). When any .NET application marked as "pure IL" runs on 64-bit Windows, it will run as a 64-bit process. Similarly, if you run that exact same application on 32-bit Windows, it will run as a 32-bit process. A 64-bit process cannot load a 32-bit DLL. Therefore, the "test.exe" program starts as a 64-bit process and then attempts to load the 32-bit "SQLite.Interop.dll", which raises the BadImageFormatException. -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] System.Data.Sqlite problem
Hello, I've just downloaded the 64 bit + 32 bit binary zip versions of System.Data.Sqlite version 1.0.74.0. I unzip and then run the test.exe program. The 64 bit version works like a charm but the 32 bit version unfortunately does not. The error message given by test.exe is given at the end of the message. The BadImageFormatException might suggest a bad download... so I've re-downloaded a number of times and the result with the 32 bit version is always the same. I am running Windows 7 64 bit with VS2010 SP1 installed so all of System.Data.Sqlite's dependencies are installed. Any ideas what's going on? Regards, Jack Hughes See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ** Exception Text ** System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'System.Data.SQLite.SQLiteFactory' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config(Int32 op, SQLiteLogCallback func, IntPtr pvUser) at System.Data.SQLite.SQLite3.SetLogCallback(SQLiteLogCallback func) in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLite3.cs:line 935 at System.Data.SQLite.SQLiteFactory..cctor() in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteFactory.cs:line 131 --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.RuntimeFieldHandle.GetValue(RtFieldInfo field, Object instance, RuntimeType fieldType, RuntimeType declaringType, Boolean& domainInitialized) at System.Reflection.RtFieldInfo.InternalGetValue(Object obj, Boolean doVisibilityCheck, Boolean doCheckConsistency) at System.Reflection.RtFieldInfo.GetValue(Object obj) at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow) at test.TestCasesDialog.runButton_Click(Object sender, EventArgs e) in c:\dev\sqlite\dotnet\test\TestCasesDialog.cs:line 56 at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ** Loaded Assemblies ** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.235 (RTMGDR.030319-2300) CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll test Assembly Version: 1.0.0.30023 Win32 Version: 1.0.0.30023 CodeBase: file:///C:/Workspace/SomeProject/2.0/Libs/sqlite-netFx40-binary-Win32-2010-1.0.74.0/test.exe System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.235 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll System Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.232 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll System.Data Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.225 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.225 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll System.Numerics Assembly Version: 4.0.0.0 Win32 Version: 4.0.3031