使用 ReSharper5 转换为 Visual Studio 2010 后,我的一些单元测试开始失败。更具体地说,这适用于使用 NHibernate 和 SQLite 的所有单元测试。这个问题似乎与 SQLite 有关。不涉及NHibernate和SQLite的单元测试仍然运行良好。
例外情况如下:
NHibernate.HibernateException : Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
----> System.Reflection.TargetInvocationException : Exception has been thrown by the
target of an invocation.
----> NHibernate.HibernateException : The IDbCommand and IDbConnection implementation
in the assembly System.Data.SQLite could not be found. Ensure that the assembly
System.Data.SQLite is located in the application directory or in the Global
Assembly Cache. If the assembly is in the GAC, use <qualifyAssembly/> element
in the application configuration file to specify the full name of the assembly.
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
例外情况是清理未成功创建的 NHibernate 对象时 TearDown 上的 NullReferenceException,但问题似乎与 SQLite 有关。
我通过 ReSharper 运行单元测试,但是当直接通过 NUnit.exe 应用程序运行它们时,我遇到了相同的异常。但是,通过 x86 变体 (NUnit-x86.exe) 运行它们,所有测试都运行良好。它可能与 64 位和 32 位 dll 的混合有关吗?通过VS2008 + ReSharper4.5仍然运行良好。
请注意,我的项目的目标框架仍然是.NET3.5。
有人以前见过这个问题吗?
64 位和 32 位 dll 之间似乎存在某种混淆。切换到使用 SQLite.dll 的 x64 变体可以解决该问题。我不确定为什么 VS2008 没有给出这个问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)