IInformationalInstruction Interface
Definition
Section titled “Definition”A Mono.Cecil Instruction wrapper which contains extra information about the instruction for analysis.
public interface IInformationalInstructionProperties
Section titled “Properties”IncomingBranches
Section titled “IncomingBranches”Incoming branches to this instruction.
HashSet<IInformationalInstruction> IncomingBranches { get; }PreviousChronological
Section titled “PreviousChronological”The immediate previous instruction in the list or an incoming branch if control flow stops at the immediate previous instruction.
IInformationalInstruction? PreviousChronological { get; }Remarks
Section titled “Remarks”In a case where there are multiple incoming branches, this will point to the first evaluated incoming branch.
If you care about finding a previous incoming invalid stack size somewhere, this will work fine.
In a case where an incoming invalid stack size exists on a branch other than what is found via backtracking with this, it’s not a problem because the error in that case is stack size mismatch which is evaluated during the CIL instruction crawling phase. And in such a case we do NOT evaluate further errors after that point because the whole stack after that point is invalid and any stack size related error would be misleading.
Previous
Section titled “Previous”The immediate instruction before this instruction.
IInformationalInstruction? Previous { get; }Remarks
Section titled “Remarks”The previous instruction may be unreachable, in which case any of its informational data not evaluated. If you want to get the “real” previous instruction, use PreviousChronological.
The immediate instruction after this instruction.
[SuppressMessage("Naming", "CA1716:Identifiers should not match keywords", Justification = "I don't care about Visual Basic.")]IInformationalInstruction? Next { get; }Instruction
Section titled “Instruction”The Mono.Cecil Instruction wrapped by this IInformationalInstruction.
Instruction Instruction { get; }StackSize
Section titled “StackSize”The calculated stack size at the end of this instruction.
int StackSize { get; }IncomingStackSize
Section titled “IncomingStackSize”The stack size before we got to this instruction.
int IncomingStackSize { get; }StackDelta
Section titled “StackDelta”The total change to the stack size done by this instruction. Calculated by summing up StackPop and StackPush.
int StackDelta { get; }StackPop
Section titled “StackPop”The pop behavior of this instruction.
int StackPop { get; }StackPush
Section titled “StackPush”The push behavior of this instruction.
int StackPush { get; }RelativeDistance
Section titled “RelativeDistance”The minimum relative distance from the first instruction in the method body, taking branching into account.
int RelativeDistance { get; }Remarks
Section titled “Remarks”Exception handlers are exceptional, which is why this distance has to be relative.
IsReachable
Section titled “IsReachable”If this instruction can be reached through following the control flow of the instructions. Instructions after conditional branches are always evaluated and considered reachable.
bool IsReachable { get; }IsEvaluated
Section titled “IsEvaluated”If this instruction was evaluated after it was created. This is the same as IsReachable when unreachable instructions aren’t evaluated such as when using CreateInformationalSnapshotJIT(MethodBody)
bool IsEvaluated { get; }ErrorAnnotations
Section titled “ErrorAnnotations”A list of error annotations on this instruction.
List<IInformationalInstruction.IAnnotation> ErrorAnnotations { get; }HasErrorAnnotations
Section titled “HasErrorAnnotations”Whether or not this instruction has any error annotations.
bool HasErrorAnnotations { get; }HandlerInfos
Section titled “HandlerInfos”Exception handler information related to this instruction.
ReadOnlyCollection<IInformationalInstruction.IHandlerInfo> HandlerInfos { get; }Methods
Section titled “Methods”CollectIncoming()
Section titled “CollectIncoming()”Collects all incoming instructions, excluding this IInformationalInstruction.
HashSet<IInformationalInstruction> CollectIncoming()Returns
Section titled “Returns”HashSet<IInformationalInstruction>
All incoming instructions.
ToString()
Section titled “ToString()”Returns a string presentation of this IInformationalInstruction.
string ToString()Returns
Section titled “Returns”ToStringWithAnnotations()
Section titled “ToStringWithAnnotations()”Returns a string presentation of this IInformationalInstruction, including error annotations.
string ToStringWithAnnotations()