If you've written a plugin DLL with Visual Studio, you probably know that you can't really debug a DLL by itself. This becomes a sticky point for developing a plugin: how do you debug it!?

Visual Studio has excellent facilities for debugging when you are launching an EXE, but for your plugin DLL it's a little more confusing. The trick is to set up your project settings so that you are actually launching Chainsaw. I'll use the Query Game Server plugin as an example.

1. Open up your project file in Visual Studio, right click on your project in the Solution Explorer and then click on Properties.

2. Click on the "Debug" tab. Click the "Start external program" radio button, and fill in the path to the Chainsaw executable. 

3. Set a breakpoint in your code. This isn't a requirement, I am listing this for illlustration purposes. As you get better with the debugger you will do whatever is necessary. 

4. Run Chainsaw with the Debug -> Start Debugging menu item.

Now when there is an exception in your plugin, you will be thrown in to the debugger instead of getting a crash dialog. You can then debug it using the standard Visual Studio debugging commands.

5. When Chainsaw starts type \plg_load querygameserver.dll to load the plugin.