升级到VS2010和Re#5后,SQLite相关的nUnit-tests出现问题 [英] Problem with SQLite related nUnit-tests after upgrade to VS2010 and Re#5

查看:86
本文介绍了升级到VS2010和Re#5后,SQLite相关的nUnit-tests出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用ReSharper5转换为Visual Studio 2010之后,我的一些单元测试开始失败.更具体地说,这适用于将NHibernate与SQLite一起使用的所有单元测试.该问题似乎与SQLite某种程度上有关.不涉及NHibernate和SQLite的单元测试仍然可以正常运行.

After converting to Visual Studio 2010 with ReSharper5 some of my unit tests started failing. More specifically this applies to all unit tests that use NHibernate with SQLite. The problem seem to be related to SQLite somehow. The unit tests that does not involve NHibernate and SQLite are still running fine.

例外情况如下:

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某种程度上有关.

The exception is the NullReferenceException on TearDown when cleaning up NHibernate objects that wasn't successfully created, but the problem seem to be related to SQLite somehow.

我通过ReSharper运行单元测试,但是当直接通过NUnit.exe应用程序运行它们时,却遇到了相同的异常.但是,通过x86变体(NUnit-x86.exe)运行它们,所有测试都可以正常运行.可能与64位和32位dll的混合使用有关吗?通过VS2008 + ReSharper4.5,它仍然可以正常运行.

I run my unit tests through ReSharper, but I get the same exception when running them directly through the NUnit.exe application. However, running them through the x86 variant (NUnit-x86.exe) all tests run fine. Can it be related to some mixing of 64bit and 32bit dlls? It still runs fine through VS2008 + ReSharper4.5.

请注意,我项目的目标框架仍然是.NET3.5.

Note that the target framework of my projects still is .NET3.5.

有人以前见过这个问题吗?

Anyone seen this problem before?

推荐答案

64位和32位dll之间似乎存在某种混淆.切换为使用SQLite.dll的x64变体可以解决此问题.我不确定为什么VS2008不会出现此问题.

There seems to be a mixup between 64bit and 32bit dlls somehow. Switching to use the x64 variant of SQLite.dll fixes the problem. I'm not sure why VS2008 doesn't give this problem though.

这篇关于升级到VS2010和Re#5后,SQLite相关的nUnit-tests出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆