This is a simple patch for BepInEx that makes MonoMod.RuntimeDetour.DetourContext.Dispose work correctly.
Installation is simple, unzip the archive to REPO\BepInEx\patchers.
For Modders (What this patch does)
Code Example
using(new DetourContext(){ Priority = 100 })
{
On.StartOfRound.Awake += Hook_2;
}
On.StartOfRound.Awake += Hook_1;
Problem Before the Patch
- DetourContext was not properly cleaning itself up.
- As a result, Hook_1 was also affected by Priority 100 (even though it was added later).
- This caused Hook_1 to run before Hook_2, which is incorrect.
Fix (with the patcher)
- Now, DetourContext properly disposes itself.
- Hook_2 gets Priority 100.
- Hook_1 remains normal priority.
- This ensures Hook_2 runs first, as expected.
Created by Hamunii







