What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

[OLD] How to Debug Your Bot/Plugin/Routine Code In Visual Studio

Status
Not open for further replies.

pushedx

Well-Known Member
Joined
Sep 24, 2013
Messages
4,252
Reaction score
290
This guide will cover the process of being able to debug your code for Exilebuddy while it is running. Starting with Beta #926 and Release #72, a few changes have been made so users can properly debug their code while it is running inside the bot.

NOTE: You can only debug code while the bot is running. You cannot change it and recompile without restarting the bot, because the bot is setup to compile once on load.

To get started, you'll need to create a project for Exilebuddy. Please see the How to Setup a Project for Exilebuddy guide to do that. Once you have a project that compiles, you're ready to begin.

Attached is a file, VS2013.zip that contains a project file for all the current bots, plugins, and routines included with the bot that contain source. We will first look at debugging the provided code. This project is setup for the BETA version of Exilebuddy, but with a minor change, you can use it with Release as well.

1. Download the "VS2013.zip" file and place it into your Exilebuddy folder.
G9uMgJV.png

2. Extract the contents into the Exilebuddy folder. Make sure the path you end up with is "<Exilebuddy Folder>\VS2013\VS2013.sln". NOTE: The "Bots", "Plugins", and "Routines" folders do not contain any files, only folders. This is because the code will be linked from the files included with Exilebuddy.
JIZBkT0.png

3. Open "VS2013.sln" from the VS2013 folder. In the Solution Explorer, you will see an organized layout of files. This will be covered later. For now, click on Build -> Build Solution. If your project is setup correctly, it should build without any errors.
Ayge9VE.png

4. Now, we can begin debugging. Start Exilebuddy from the main folder you just extracted the VS2013 folder into. Make sure everything is setup in terms of plugins and settings, but do not Start the bot yet. For this example, we'll debug the AutoFlask plugin, since it's enabled by default.
uIwaaIR.png

5. Switch back to the VS2013 project in Visual Studio. Click on "Debug" -> "Attach to Process..." from the main menu.
yKu8e9i.png

6. In the new "Attach to Process" window that appears, you will need to select your "Exilebuddy" process. Click "Attach" once you have selected it.
JjCeOL2.png

7. Visual Studio is now attached to Exilebuddy, and you'll be able to debug any of the current code loaded. Open the AutoFlask.cs file in the Solution Explorer. Scroll down to the Tick function and place a breakpoint on the first line using F9.
vgfn10K.png

8. Click on "Start" in Exilebuddy to start the bot. After the startup code is executed, the breakpoint will trigger for the AutoFlask plugin.
fSEl9ke.png

You are now setup to debug any of the provided code though Visual Studio!

To debug your own code, you have two options:
1. Simply add new folders and file links to the VS2013 project so you can debug everything at once.
2. Create a new project that only includes file links your code. The code must compile and the project must have all required References.

You can refer to the References set in the VS2013 solution if you are having trouble making your own project.

File links are links to files that you can add in Visual Studio so the code is not physically copied over. To add a file link:
1. Right click on the folder where the file should appear.
2. Choose "Add" -> "Existing Item..."
3. Click on the file you want to add to highlight it.
4. Click on the down arrow on the right side of the Add button.
5. Choose "Add As Link".
46S8Gqy.png

The "CompiledAssemblies" folder inside your Exilebuddy folder contains the compiled DLLs/PDBs for bots, plugins, and routines loaded by Exilebuddy.

If you wish to use the Release version of Exilebuddy, you'll need to remove the Reference to ExilebuddyBETA and replace it with Exilebuddy. If you're unsure about how to do this, please see the following tutorial: How to: Add or Remove References By Using the Add Reference Dialog Box.
 

Attachments

Last edited by a moderator:
Status
Not open for further replies.
Back
Top