views:

187

answers:

1

I have a .NET 3.5 assembly covered by around 4000 MbUnit tests. I hve been running these using the mbunit.cons.exe program with no trouble.

Now I am trying to switch to Gallio (mbunit.cons.exe started blowing up with an 'out of memory' exception when producing the XML report).

When running the tests in Icarus, most of them fail with the following exception:

System.TypeInitializationException: The type initializer for 'Rhino.Mocks.MockRepository' threw an exception. --->
System.IO.FileLoadException: Could not load file or assembly 'Castle.DynamicProxy2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040) at Rhino.Mocks.MockRepository..cctor()

The assembly under test does use dynamic proxy. The dynamic proxy assembly is in the same directory as the assembly under test.

I have tried putting the directory containing the assemblies in the 'hint directories', 'application base directory' and 'working directory' fields in Icarus, but this does not alter the result.

Has anyone successfully used Gallio and Dynamic Proxy together, or have any hints as to what the problem could be?

A: 

Looks like Rhino.Mocks references a different version of Castle.DynamicProxy2. It tries to look for 'Castle.DynamicProxy2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'. Can you have a look at the Castle.DynamicProxy2 assembly in your bin folder and see if it has the same version and PubliKeyToken?

Igor Zevaka
You know what? You're right! I have version 2.1.0.0But what I can't understand is why the assembly would work correctly on its own and with MbUnit, but not with Gallio.Turns out that we're using two different third party DLLs (Micro Kernel and Rhino Mocks) that rely on two different versions of Dynamic Proxy.It'll be a while before I can get the versions straightened out and find out if this works. Thanks for putting me on the right track.
andypaxo
Rhino.Mocks internalizes DynamicProxy using ILMerge. So unless you built your own copy from source and did not perform the merge, I'm surprised by the behavior you are describing.
Jeff Brown
@Jeff... Yep, figured that out eventually. We were using the unmerged release of Rhino. Unfortunately, the merged version doesn't internalize quite everything so we had problems with that as well (our project uses Castle Windsor). Running ILMerge myself to get (almost) everything internalized works great, though.
andypaxo