Documentation/articles/patching-finalizer.md
A finalizer is a method that makes Harmony wrap the original and all other patches in a try/catch block. It can receive a thrown exception and even suppress it or return a different one.
It is a very good candidate for code that has to run regardless of what happens. Its counterpart is a Prefix with no side effects (void return type and no ref/out arguments). These are never skipped and thus serve as a way to run code guaranteed at the start of a method.
Finalizers are commonly used to:
static Exception Finalizer()
{
return null;
}
static void Finalizer(Exception __exception)
{
}
[!code-csharpexample]
Beside their handling of exceptions they can receive the same arguments as Postfixes.