Debugging
How to set up the debugger in Visual Studio or JetBrains Rider.
Last updated
How to set up the debugger in Visual Studio or JetBrains Rider.
Last updated
While developing, you may encounter bugs that are not easily understandable by simply logging variables to the console. In such cases, a debugger can be incredibly useful. It allows you to inspect values in real time, helping you better understand what is happening and identify the root cause of the issue.
We assume that you have already set up your server-side plugin. If not, please create one first.
Open your project in Visual Studio
.
Navigate to the Debug
tab at the top of the IDE.
In the context menu, scroll down and click on Debug Properties
at the bottom.
This will open the Launch Profiles
window.
Click on Create a new profile
at the top left.
Then, select Executable
from the options.
This will create your new profile. In our example, we renamed it to Debug Server
. You can find the rename option above the profile, located at the far right.
Now, select the Executable
and click on Browse
.
After clicking, a dialog will open.
Navigate to and select Server.Loader.exe
, then click Open
at the bottom right.
The dialog will close. Now, you need to define the Working Directory
. To do this, click on Browse...
. This will open another dialog.
Here, you need to select the folder containing your Hogwarp server files
, where the Server.Loader.exe
is located.
Click OK
to close the dialog. Now, you can close the Launch Profiles
dialog as well.
After configuring the debugger, you can now start your server within the IDE and begin debugging it.
To effectively debug your server, we recommend changing your configuration to use Debug
mode instead of Release
mode.
After making this change, ensure that your created profile is selected if it isn’t already.
Now, click on your profile—in our case, Debug Server
—and the server should start with debugging enabled. As an example, we added a breakpoint at line 10
to demonstrate how it looks when it’s working.