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; }
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)); }