示例#1
0
 public MsilTryCatchOperation(MsilTryCatchOperationType op, Type caughtType = null)
 {
     Type = op;
     if (caughtType != null && op != MsilTryCatchOperationType.BeginClauseBlock)
     {
         throw new ArgumentException($"Can't use caught type with operation type {op}", nameof(caughtType));
     }
     CatchType = caughtType;
 }
示例#2
0
        private void AddEhHandler(int offset, MsilTryCatchOperationType op, Type type = null)
        {
            var instruction = FindInstruction(offset);

            instruction.TryCatchOperations.Add(new MsilTryCatchOperation(op, type)
            {
                NativeOffset = offset
            });
            instruction.TryCatchOperations.Sort((a, b) => a.NativeOffset.CompareTo(b.NativeOffset));
        }