Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Debugging with dnSpy
Due to the in-memory patching introduced in BepInEx 4.0, it is not possible to use dnSpy to debug plugins with the base installation of BepInEx. Instead, the developers must use the modified
The dnSpy-compatible BepInEx patcher does not support in-memory preloader patchers!
Thus, you can only debug normal plug-ins.
Setting up BepInEx
The permanent assembly patcher for BepInEx is provided as a separate download in the Bleeding Edge builds. In order to use the dnSpy debugger functionality, you must apply the hardpatch to the game.
To set up BepInEx to work with dnSpy debugger, do the following:
Install base BepInEx as per the installation guide.
BepInEx.Patcher.exeinto the game's root folder
mono BepInEx.Patcher.exeif you are on Linux/macOS). This will patch game's
BepInEx.Bootstrap.dllinto the game's
Setting up dnSpy
- Download the latest version of dnSpy and an appropritate version of Unity-debugging package
- From the downloaded Unity-debugging package, pick
mono.dllthat corresponds to the version of the game you want to debug and replace the game's original
- Open dnSpy and open the plugin DLL (from
BepInExfolder) you want to debug. Additionally, open game's own assemblies to debug (from
- Set up appropriate breakpoints
Debug > Start Debuggingdialogue
Unityas the Debug engine, select the game's EXE (not the launcher) and press OK to start debugging
If everything worked correctly, dnSpy will not time out in 30 seconds (or in whatever timeout time you configured) and will break on any breakpoint you set.
Reverting back to original BepInEx
When you don't want to debug anymore, you can revert back to the original game installation as follows:
mono.dllto the original version
Managedfolder found in the game's root (or its subfolders), remove