views:

148

answers:

2

We have an application here which is using postsharp to wrap certain methods within a transaction aspect derived from MethodInterceptionAspect. We use NHibernate 2.0 as an ORM for the application. There is a failure within this block of code,

public override void OnInvoke(MethodInterceptionArgs args)
{
    using (TransactionScope transaction = CreateTransactionScope())
    {
        args.Proceed();
        transaction.Complete();
    }
}

that results in the following error: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) This only seems to happen for calls to save, and not delete or get calls.

I was wondering if anyone had encountered anything similar ever?

A: 

Yes, I've encountered this. Usually its a 64/32 bit problem. Check the target in your project settings.

jfar
Target was set to any cpu, which is x64 in my case. I'm fairly certain it's not a 64/32 bit problem since the entire stack is 64 bit.
intervigil
A: 

That's odd. What tells PEVERIFY if you execute it on PostSharp output?

Gael Fraiteur