BadImageFormatException, but not when debugging

2 views
Skip to first unread message

yesthatmcgurk

unread,
Jul 30, 2008, 4:47:02 PM7/30/08
to Castle Project Development List
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.

TIA

Ayende Rahien

unread,
Jul 30, 2008, 4:54:03 PM7/30/08
to castle-pro...@googlegroups.com
Please contact Kzu to see what he can do about that.

josh robb

unread,
Jul 31, 2008, 2:14:56 AM7/31/08
to castle-pro...@googlegroups.com
On Thu, Jul 31, 2008 at 6:47 AM, yesthatmcgurk <yestha...@gmail.com> wrote:
> 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.

As an aside - you probably don't want to be mocking the container
interface - this is probably a sign that you've got some design
problems elsewhere. (Or that you just have very esoteric
requirements).

j.

yesthatmcgurk

unread,
Jul 31, 2008, 9:07:38 AM7/31/08
to Castle Project Development List
Well, I figured because it was happening down in the Castle I'd see if
you guys have encountered this.

The fact that it's only thrown when NOT debugging is the thing that's
throwing me the most.

On Jul 30, 4:54 pm, "Ayende Rahien" <aye...@ayende.com> wrote:
> Please contact Kzu to see what he can do about that.
>
> On Wed, Jul 30, 2008 at 11:47 PM, yesthatmcgurk <yesthatmcg...@gmail.com>wrote:
>
>
>
>
>
> > 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.
>
> > TIA- Hide quoted text -
>
> - Show quoted text -

yesthatmcgurk

unread,
Jul 31, 2008, 9:10:32 AM7/31/08
to Castle Project Development List
Actually, that's exactly what I want to do. I want to test a single
method; if that method uses Unity to inject other objects, I want to
make sure it performs its task properly. I don't want to test Unity;
that's the job of the P&P group. So I mock their container and set
expectations on what it will be asked to do. I then execute the
method under test and verify my expectations on the unity mock have
been met.

On Jul 31, 2:14 am, "josh robb" <josh_r...@fastmail.fm> wrote:

Ayende Rahien

unread,
Aug 2, 2008, 9:28:41 AM8/2/08
to castle-pro...@googlegroups.com
Try it with Rhino Mocks.
Reply all
Reply to author
Forward
0 new messages