Gallio:在探索测试时抛出异常:System.Reflection.ReflectionTypeLoadException

时间:2011-11-18 19:02:05

标签: unit-testing mbunit gallio

我可以使用CodeRush通过VS2010运行我的单元测试但是当我尝试使用Icarus Test Runner运行测试时,我得到了这个错误。

An exception was thrown while exploring tests.
Location: C:\XXX\XXX.Server.Tests\bin\Release\XXX.Server.Tests.DLL 
Reference: XXXServer.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Details: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. 
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) 
at System.Reflection.Assembly.GetTypes() 
at Gallio.Common.Reflection.Impl.NativeAssemblyWrapper.GetTypes()
at Gallio.Framework.Pattern.TestAssemblyPatternAttribute.PopulateChildrenImmediately(IPatternScope assemblyScope, IAssemblyInfo assembly)
at Gallio.Framework.Pattern.TestAssemblyPatternAttribute.Consume(IPatternScope containingScope, ICodeElementInfo codeElement, Boolean skipChildren)
at Gallio.Framework.Pattern.DefaultPatternEvaluator.Consume(IPatternScope containingScope, ICodeElementInfo codeElement, Boolean skipChildren, IPattern defaultPrimaryPattern)

我确保将项目引用的Copy Local设置为True。

1 个答案:

答案 0 :(得分:1)

测试正在64位计算机上运行,​​测试项目平台目标设置为“任何CPU”,而正在测试的项目设置为“x86”。因此,机器将测试加载为64,这在尝试以相同方式加载正在测试的项目时导致错误。