gpt4 book ai didi

nhibernate - 升级到 VS2010 和 Re#5 后 SQLite 相关 nUnit 测试的问题

转载 作者:IT王子 更新时间:2023-10-29 06:31:00 27 4
gpt4 key购买 nike

在使用 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 没有给出这个问题。

关于nhibernate - 升级到 VS2010 和 Re#5 后 SQLite 相关 nUnit 测试的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2688993/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com