欢迎投稿

今日深度:

SQLite异常:unsafenativemethods.sqlite3_open_interop,

SQLite异常:unsafenativemethods.sqlite3_open_interop,


在.NET CF(WM 6)中使用了System.Data.SQLite,程序在个别手机(WM6.1和6.5)上运行异常,异常提示为unsafenativemethods.sqlite3_open_interop方法。如果你使用的是早期版本的System.Data.SQLite,那么在WM6.1或高版本的手机上可能会出现此异常。

2009111314220124.jpg

在System.Data.SQLite的Version History发现了这样的描述:

1.0.50.0 - June 27, 2008
Enhanced the mergebin utility to work around the strong name validation bug on the Compact Framework.  The old workaround kludged the DLL and caused WM6.1 to fail to load it.  This new solution is permanent and no longer kludges the DLL. 


我使用的是1.0.48版,这个版本包括了SQLite引擎和ADO.NET的封装。作者把它们合并到了一个dll文件中。这个dll同时支持native code或managed code调用。但在1.0.50版本的更新中,已经取消了这样的方式。 即ADO.NET provider for SQLite和SQLite.Interop分开单独提供。所以后续版本的System.Data.SQLite.dll文件仅是一个ADO.NET provider for SQLite,不包含SQLite的源码,而nativer的封装在SQLite.Interop.xxx.dll这样的文件中。System.Data.SQLite.dll使用时需要p/invoke SQLite.Interop.xxx.dll。

引用了新的程序集后,没有发现上面这个异常。

作者在后续的版本中提供了ManagedOnly的System.Data.SQLite.dll,使用时需要native sqlite3.dll or Linux shared library fromhttp://www.sqlite.org,我在asp.net 中测试可以使用,但在.NET CF中异常。看来这个ManagedOnly应该不支持arm平台。

 

标签:Windows Mobile,.NET CF,SQLite,System.Data.SQLite
http://chy710.cnblogs.com

 

本文转自chy710博客园博客,原文链接:http://www.cnblogs.com/chy710/archive/2009/11/13/1602505.html,如需转载请自行联系原作者

www.htsjk.Com true http://www.htsjk.com/SQLite/25229.html NewsArticle SQLite异常:unsafenativemethods.sqlite3_open_interop, 在.NET CF(WM 6)中使用了System.Data.SQLite,程序在个别手机(WM6.1和6.5)上运行异常,异常提示为unsafenativemethods.sqlite3_open_interop方法。如果你使用的...
评论暂时关闭