.net – CorFlags.exe,System.Data.SQLite.dll和BadImageFormatException

http://sqlite.phxsoftware.com/对System.Data.SQLite.dll运行 CorFlags.exe会产生以下输出.

Version   : v2.0.50727
CLR Header: 2.5
PE        : PE32
CorFlags  : 24
ILONLY    : 0
32BIT     : 0
Signed    : 1

如您所见,未指定32BIT且PE等于PE32.根据Moving from 32-bit to 64-bit application development on .NET Framework,这意味着该组件是任何CPU.但是,使用64位应用程序中的程序集会导致错误:

System.BadImageFormatException: Could
not load file or assembly
‘System.Data.SQLite’ or one of its
dependencies. An attempt was made to
load a program with an incorrect
format. File name:
‘System.Data.SQLite’

如果CorFlags.exe报告任何CPU,为什么会发生异常?组件是否错误标记为32BIT:0?

我知道有一个64位版本也可用,我只是想知道导致错误的原因.

解决方法

您使用的System.Data.SQLite.dll文件是 mixed-mode assembly,这意味着它不是纯.NET代码(另请参阅“ILONLY:0”标志),它还包含非托管机器代码,不能是“任何”中央处理器”.因此,由于DLL包含32位本机代码,因此只能将其加载到32位进程中,否则会发生BadImageFormatException.

相关文章

SQLite架构简单,又有Json计算能力,有时会承担Json文件/RES...
使用Python操作内置数据库SQLite以及MySQL数据库。
破解微信数据库密码,用python导出微信聊天记录
(Unity)SQLite 是一个软件库,实现了自给自足的、无服务器...
安卓开发,利用SQLite实现登陆注册功能