BadImageFormatException

16 views
Skip to first unread message

yesthatmcgurk

unread,
Jul 30, 2008, 3:41:27 PM7/30/08
to Moq Discussions
I'm getting this exception when I mock IUnityContainer from the EL's
Unity block. The annoying thing is that I can't debug this, because
the exception isn't thrown when I'm debugging. In other words, when I
hit ctrl-R, T (run tests in current context) it fails, but when I hit
ctrl-r, ctrl-t (debug tests in current context) it doesn't fail.

Any ideas?

yesthatmcgurk

unread,
Jul 31, 2008, 1:58:51 PM7/31/08
to Moq Discussions
I posted this to Castle:

-- start

I'm using the MoQ framework which uses castle to proxy types. I'm
getting a BadImageFormatException when attempting to proxy the
IUnityContainer interface of the Enterprise Library's Unity block.

The odd thing is that the exception is thrown when I'm running my
tests, but when I switch to debug in order to examine the exception,
the exception isn't thrown and the tests pass.

I've been scanning related posts, but I haven't found any information
to help me out. I also can't find out what version of Castle is
being
used, but I believe it is the latest stable build.

--end

They said, "ask kzu." Wow, that was helpful.

Daniel Cazzulino

unread,
Jul 31, 2008, 2:03:38 PM7/31/08
to moq...@googlegroups.com
could you provide a full repro and attach it to a new issue?

thank!

Daniel Cazzulino

unread,
Jul 31, 2008, 2:47:35 PM7/31/08
to moq...@googlegroups.com
haha... helpful indeed...
will try to get a repro for them then :(

yesthatmcgurk

unread,
Aug 1, 2008, 10:55:42 AM8/1/08
to Moq Discussions
Its accessors. I've got the project; creating an issue to attach it,
but the bug isn't in Moq. Its an issue with visual studio's
accessors.

This works:
var moq = new Mock<IUnityContainer>();

this fails:
var moq = new Mock<IUnityContainer>();
ProviderContainer target = new ProviderContainer();
// Accessor() is an extension that returns ProviderContainer_Accessor
target.Accessor()._container = moq.Object;


On Jul 31, 2:47 pm, "Daniel Cazzulino" <dan...@cazzulino.com> wrote:
> haha... helpful indeed...
> will try to get a repro for them then :(
>
> > > Any ideas?- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages