private static List<Instruction> GetCatchHandlerInstructions(ILProcessor processor, VariableDefinition attributeVariableDefinition, VariableDefinition exceptionVariableDefinition, MethodReference onExceptionMethodRef)
{
// Store the exception in __fody$exception
// Call __fody$attribute.OnExcetion("{methodName}", __fody$exception)
// rethrow
return new List<Instruction>
{
processor.Create(OpCodes.Stloc_S, exceptionVariableDefinition),
processor.Create(OpCodes.Ldloc_S, attributeVariableDefinition),
processor.Create(OpCodes.Ldloc_S, exceptionVariableDefinition),
processor.Create(OpCodes.Callvirt, onExceptionMethodRef),
processor.Create(OpCodes.Rethrow)
};
}