Tip on Writing Reflector Addins

by Jason Haley 20. September 2011 16:44

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.

  1. Write your addin and build it
  2. In VS, right click your solution in the Solution Explorer
  3. Select Open Folder in Windows Explorer      image
  4. Navigate to your bin\Debug folder
  5. 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).
  6. Add your debug build addin to Reflector (Tools –> Addins)
  7. 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.
  8. Back in VS, right click on your addin project and choose Properties
  9. On the Debug tab, select the Start external program radio button
  10. Click the browse ‘…’ button to get the file dialog
  11. Navigate to the bin\debug menu of your project and select the Reflector.exe located in there.  image
  12. Set a break point in your code where you want it
  13. 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.

Comments (0) | Post RSSRSS comment feed |


Comments are closed