Exception thrown in calculating maxstack


I'm getting "Invalid stack depth reached: inconsistent stack depth at offset 98" error while calling "GetMaxStackDepthRequired" function. I'm just reading the lib and then get the set of instructions using
CILInstructions instructions = methodDef.GetCodeBuffer();
and then, trying to calculate maxstack using,
int curmaxstack = instructions.GetMaxStackDepthRequired();
And, above functions throws "InvalidStackDepth" exception.
is there anything wrong in the existing lib code?

file attachments


k_john_gough wrote Sep 13, 2011 at 4:43 AM

Hi shah amish b
So far as I know there is no issues with the computation of GetMaxStackDepthRequired. Is the exception happening when you test code that you have added to the buffer yourself, or when processing code that was written by another processor (and passes PEVERIFY).

If you can send me a message, we can switch to email and try to solve the problem.

PERWAPI has not been modified for some while, and has some issues with .NET V4 code. Might this be the problem?


wrote Feb 13, 2013 at 1:06 AM