-
-
Notifications
You must be signed in to change notification settings - Fork 1
99.1) Debugging
Latest version of Doorstop Bepinex uses allows for connecting to a debugger. To enable that functionality, following settings in doorstop_config.ini have to be enabled:
# If true, Mono debugger server will be enabled
debug_enabled = True
# When debug_enabled is true, specifies the address to use for the debugger server
debug_address = 127.0.0.1:10000
# If true and debug_enabled is true, Mono debugger server will suspend the game execution until a debugger is attached
debug_suspend = trueThe last option is optional, and will make the game wait till it detects the debugger connection before launching. Please be aware that while waiting it will not even show a window, so if you then decide 'actually i don't want to debug' you will need to kill the process by hand.
Once this is done, launch a .NET debugger like dnSpy or Visual Studio, and set them to listen on 127.0.0.1 with port 10000.
On dnSpy it is done by selecting "Debug" > "Start Debugging" and selecting "Unity (Connect)" as the debug engine:

Afterwards launch the game, and your debugger should pick it right up. For better results when debugging mods they should be compiled with 'Debug' preset, you will also need to copy over the .pdb file your compiler generated and place it next to the .dll in the mod's folder. Without the .pdb file some variable names will be lost.
One of the most common features (outside of adding Breakpoints) you might wish to use is 'Breakpoint on Exception', wherein the execution of the program will be paused when encountering an exception of selected types, and you will be sent to the line of code which caused it. In dnSpy you can select what exception types should cause a break in the "Exception Settings" window.
Please be aware that the wiki pages might refer to the build present in the latest commit, and not the release build.
While i try to avoid making such edits long before releasing update containing said feature, there might be short gaps like that!