Skip to content

Commit

Permalink
Add null/zero return clarifcations for TargetMethod/s (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
SineSwiper committed Aug 27, 2023
1 parent f7004f8 commit 4c9a3d1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Harmony/Documentation/articles/patching-auxilary.md
Expand Up @@ -42,7 +42,7 @@ static MethodBase TargetMethod(...)
static MethodBase CalculateMethod(...)
```

That method, if it exists, is expected to return a `MethodBase` of the method to be patched.
That method, if it exists, is expected to return a `MethodBase` of the method to be patched. The return cannot be null. If you want to conditionally skip patching, use a `Prepare()` method.

### TargetMethods

Expand All @@ -59,6 +59,8 @@ A typical implementation would `yield` the results like this:

[!code-csharp[example](../examples/patching-auxilary.cs?name=yield)]

Similar to `TargetMethod`, the implementation cannot return zero results. If you want to conditionally skip patching, use a `Prepare()` method.

### Cleanup

After patching, Harmony gives you a chance to clean up your state. For this, Harmony searches for a method called
Expand Down

0 comments on commit 4c9a3d1

Please sign in to comment.