Export to GitHub

moq - issue #87

BadImageFormatException when using a mock with a Visual Studio generated Accessor object


Posted on Aug 1, 2008 by Quick Kangaroo

(see attached solution for repro) The exception is thrown when running tests but not when debugging them.

Submitting so that I could attach the solution; this is a bug in either Castle or VS, not in Moq (as far as I can tell).

Attachments

Comment #1

Posted on Feb 4, 2009 by Happy Rabbit

Wow... was just looking at this issue and it's WEIRD! I'm thinking whether this might be an x64 issue? I run the same example but selecting an explicit x86 target platform, to force the 32bit CLR, but got the same error. I'm wondering if it might work if you compile the Unity assemblies for x86 explicitly?

Comment #2

Posted on Mar 16, 2009 by Happy Lion

I don't think it is a x64 issue, I get the same error on a x86 XP machine and a x64 Vista Enterprise machine

Ryan Rauh

Comment #3

Posted on Jul 4, 2009 by Helpful Ox

Can you redo the test project to not use MSTest? I could take a look at it then.

Comment #4

Posted on Oct 1, 2009 by Quick Lion

Is this issue still occurring under the latest builds of DynamicProxy?

Comment #5

Posted on Apr 7, 2010 by Happy Camel

I'm afraid yes - this issue occurs with latest moq for silverlight when trying to mock IUnityContainer

Comment #6

Posted on Apr 7, 2010 by Helpful Ox

which version of DP does latest Moq use?

Comment #7

Posted on Apr 7, 2010 by Helpful Ox

I just checked on the trunk version of DP (without MOQ) and it works like a charm. Pretty sure it works on v2.2 as well.

Comment #8

Posted on Apr 12, 2010 by Helpful Horse

Is the real problem here the "where" clauses on the IUnityContainer methods? See also issue #245.

Comment #9

Posted on Apr 12, 2010 by Helpful Ox

Yes, the where clause was the issue, and it is fixed (supported) now in DP 2.2

Comment #10

Posted on Apr 12, 2010 by Happy Rabbit

Update to DP2.2

Comment #11

Posted on Apr 21, 2010 by Happy Lion

Trunk version

Status: Fixed

Labels:
Type-Other Priority-High Milestone-Release4.0