tags:

views:

975

answers:

3

I have a simple lambda expression which runs fine as a UNIT test and also runs fine when I copy the code into the Main method of my application. However, when I run the same piece of code within a callback method (via JMS courier) I get the above error. Has anyone encountered this?

Example code failing:

Expression<Func<JupiterDividend, bool>> expr = v => true;
expr.Compile();  // This is what fails
+1  A: 

You will normally get this sort of error when a ModuleBuilder has already been 'compiled', or a TypeBuilder has already been 'compiled'.

I would check where such things happen. Also, a stack trace may be handy in this case.

leppie
+1  A: 
Grahame Rogers
Is this callback maybe in another appdomain? Is there anything 'funny' about the JupiterDividend class?
leppie
A: 

There is a bug report here, not sure though if it is the same issue that you experience. Apparently this has been fixed in .NET 3.5 SP1.

liggett78
Your link is incorrect
GvS
Link has been fixed
liggett78