Found it in the CIL Spec Part 3:
1.7.5 Backward Branch Constraints
It must be possible, with a single forward-pass through the CIL instruction
stream for any method, to infer the exact state of the evaluation stack at
every instruction (where by "state" we mean the number and type of each item
on the evaluation stack).
In particular, if that single-pass analysis arrives at an instruction, call
it location X, that immediately follows an unconditional branch, and where X
is not the target of an earlier branch instruction, then the state of the
evaluation stack at X, clearly, cannot be derived from existing information.
In this case, the CLI demands that the evaluation stack at X be empty.
Following on from this rule, it would clearly be invalid CIL if a later
branch instruction to X were to have a non-empty evaluation stack
The spec uses the word invalid. So, is my code not only unverifiable but
also illegal? However, I think I can deal with this with an unreachable
instruction setting the correct stack depth.
> The method initializes a BitArray field from an array of indexes to be set
> (MyClass/Bits is an enum)
[quoted text clipped - 45 lines]
>
> Are unconditional forward branches forbidden?
"Jeffrey Tan[MSFT]" - 29 Jun 2006 07:47 GMT
Hi Ben,
Thanks for your post!
Yes, this "Backward Branch Constraints" is the root cause for this error
message. This is considered as an illegal. PEVerify will produce this error
message if you fail to obey the rule. Please refer to the link below:
"PEVerify does not respect Backward Branch Constraints. "
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedbac
kID=96968
Hope this helps!
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.