How are folks using VS debugging their bot's?


#1

Am using VS (2017) to write a bot. I can compile the DLL (albeit a Self contained core .NET app) and run that through Halite.exe on the command line fine. However, I am not sure how to debug the code using VS IDE’s debugger? I am not overly familiar with the mechanism employed here, but it seems that the DLL (using Newtonsoft.Json.dll to allow the MyBot.dll to act as a self contained app) can be launched to debug directly from VS, which isn’t useful as the halite.exe is not invoked here. Or via the CLI as an argument to halite.exe.

I was hoping that I could launch halite.exe as the executable in the “Debug” window the project properties in VS and provide the arguments accordingly and in doing this it will launch and run the bot, but it won’t stop at any breakpoints as I don’t believe it is actually launching the DLL against the halite.exe, but rather just doing the same as the CLI method.

Essentially I am wondering if there is a way to debug the code directly through VS IDE whilst it is running under a Halite.exe invoked launch? I appreciate that there are Logs I can dump, which is currently the way I am debugging, but there are subtleties in the code that I am not seeing from logs and could easily capture by stepping through the code.

thanks


#2

Hi , I am also building my bot using VS2017. I don’t know if there’s a way to invoke the debugger from halite.exe. I never tried this, but I was just thinking on an workaround. Modify your bot to save the commands received to a file, and then change again to have an option to run and process the this file. In this way you can run your bot in debug mode from VS. I would like to try that but I have many other things to do in my bot.
Hope this helps, let me know if the idea is clear.
Good luck!


#3

Hi, thanks for the response. I was thinking along the lines of saving out the commands in a log of sorts (although I think this is essentially already done in the .hlt file that is produced). Alternatively, I guess we have access to the halite source code and could compile that in as a separate project (currently its all compiled through CMake) and run it all at the same time (halite source project & bot project)?