I have to admit, I’ve been bad about updating my Reflector addins this year … actually addin – I only have one currently – Reflector.Snippy. However this past weekend I was looking over the forum at http://forums.reflector.net/ and noticed people reporting that Snippy was broke … so I dug up the code and fixed it.
How to set a breakpoint in an addin
This is one of those things that are so obvious that you don’t necessarily see it … or at least I didn’t until last year sometime. Back in 2007 I posted about using Debugger.Break() – (Getting started with Reflector-Addins) however the way shown below is much easier.
- Write your addin and build it
- In VS, right click your solution in the Solution Explorer
- Select Open Folder in Windows Explorer
- Navigate to your bin\Debug folder
- Run the Reflector.exe that is in that folder (since you have a reference set to the Reflector.exe in your addin, VS will create a copy in your debug folder by default).
- Add your debug build addin to Reflector (Tools –> Addins)
- After you have added your addin, close Reflector. This will save the settings so you don’t have to add the addin again when you launch the debugger.
- Back in VS, right click on your addin project and choose Properties
- On the Debug tab, select the Start external program radio button
- Click the browse ‘…’ button to get the file dialog
- Navigate to the bin\debug menu of your project and select the Reflector.exe located in there.
- Set a break point in your code where you want it
- Hit F5 or Debug –> Start Debugging
Now as you use the addin and hit the code that has the breakpoint set in your VS, it will break into the debugger nice and clean.