Gallio: An exception was thrown while exploring tests: System.Reflection.ReflectionTypeLoadException

StackOverflow https://stackoverflow.com/questions/8187702

  •  04-03-2021
  •  | 
  •  

Question

I'm able to run my unit tests through VS2010 with the CodeRush but when I try to run the tests with Icarus Test Runner I get this error.

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)

I've made sure Copy Local is set to True for project references.

Was it helpful?

Solution

Tests were being run on a 64bit machine with the test project Platform target set to "Any CPU" while the project being tested was set to "x86". So the machine was loading the tests as 64 which caused the error when trying to load the project being tested the same way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top