Using .NET Reflector Add-ins
19 November 2008
.NET Reflector by itself is great, but it really comes into its own with the help of some add-ins. Here we provide you with an introduction to the Add-ins, explain briefly what they do, and encourage you to write your own in order to get .NET Reflector to work the way you want it to!
Whereas .NET Reflector aims to provide all the basic functionality for browsing assemblies and their contents, it has been designed from the start to encourage others to add functionality to it. Some of these add-ins were written initially by Lutz Roeder as an illustration of the ways that Reflector can be extended, but there have been many other contributions that have turned .NET Reflector into a much more versatile tool that has kept up with all the diverse ways that the NET platform has developed, and has evolved to meet the needs of development teams. It also means that a ‘power’ user can add functionality for particular, almost unique, requirements.
Downloading an add-in
Installing an Add-In
Installing an add-in is generally very easy. It is just a matter of copying the add-in to the directory in which you installed .NET Reflector and then registering it on NET Reflector using the View->Add-ins… Menu item
Clicking on the Add-Ins… menu item displays the Add-ins maintenance dialog box. Clicking on the Add… button allows you to select the DLL file that represents the Add-in you want to register with .Net Reflector.
It really is that simple.
The existing add-ins are all worth trying out. All the ones listed here are free to download. Some, such as CodeModelView and ClassView are really no more than learning tools for anyone wanting to write an Add-in. Some are ‘alpha’ projects that are awaiting completion, whereas many are complete and would be difficult to improve upon. Not all Add-ins will be useful to the average developer; some were written for a specific use which is unlikely to cause general excitement, and others are useful only very occasionally. Others are essential. It is difficult to make hard-and-fast rules about this, but, for example, anyone developing CLR routines for SQL Server will need SQL2005Browser, and probably also the FileGenerator For Reflector, whereas anyone working with Silverlight would do well to have either SilverlightLoader or SilverlightBrowser. By using Add-ins, one can make .NET Reflector a far better fit with the architecture you are developing with. We have included those add-ins for IDEs such as Visual Studio and SharpDevelop that allow Net Reflector to be used as part of the IDE, so that, by right-clicking a method or class, it can be examined in .NET Reflector.
The Add-ins can be categorized in the following ways
- Languages for the disassembler.
- These add to the built-in languages. Each language that is installed is added to the language drop-down list in the icon bar.
McppLanguage, Delphi Language for Net Reflector, PowerShellLanguage, ReflectionEmitLanguage, CppCliLanguage
- File Writers.
- As .NET Reflector has no built-in way of writing decompiled assemblies out to file, these addins are geared to do this
FileDisassembler, FileGenerator For Reflector
- Browser extensions.
- These allow assemblies to be fetched from Silverlight, SQL Server, running assemblies, zipped files etc.
BizTalk Disassembler, Running Assembly Reflector Add-in, OpenZip, ComLoader,
- IDE Addin-managers.
- These allow .NET Reflector to be invoked from within Visual Studio and other IDEs.
Building the reflector Add-in, SharpDevelop Community, TestDriven, Hawkeye add-in, Scout
- Assembly diagramming and metrics.
- E.g. Graph, SequenceViz, CodeMetrics, XMI4dotnet, Autodiagrammer, DependencyStructureMatrix, TreeMap
- Sample Add-ins
- These were written primarily as example add-ins
- Comparing assemblies
- Searching and sorting
- AssemblyCollection.Sort, CodeSearch
- Resource Viewers
- BamlViewer, Enums, RuleSetEditor
- Debugging and modifying assemblies
- Reflexil, Deblector
- Doubler, Pex
This add-in sorts (or reorders) the assembly listing in Reflector alphabetically.
The AssemblyListEx add-in allows you to create assembly list files (.ref) and load a set of assemblies directly into reflector by double clicking on the file.
This add-in draws class diagrams. provides the class diagramming capabilities. It is well-documented on CodeProject
This add-in loads assemblies containing BAML resources (e.g. localized resource assemblies) and shows the corresponding XAML.
This Add-in will list, and optionally extract, BizTalk artifacts from within an assembly. You can see a list of all artifacts, with their type, name, and the namespace they were compiled into, by rBy then clicking the "Decompile..." button, you can decompile all selected artifacts into source files.
This is a Visual Studio addin called ManagedAddIns that makes Reflector into an Add-In for Visual Studio.NET . It allows almost any Windows Forms application to be run as an add-in to Visual Studio
This add-in extended Reflector with a Chrome language rendering module. Now withdrawn.
Shows class definitions as plain text with color
Coding. It is a sample add-in which is designed to illustrate how to add a view window to reflector and to demonstrate using the code model, code translation and language writer APIs
Jonathan de Halleux
The CodeMetrics add-in analyses and computes several code quality metrics on your assemblies. This add-in uses Reflector to compute classic metrics such as cyclomatic complexity or more straightforward ones such as the number of local variables in a method. All results can be saved to a file. When you explore the result, you can double-click on an item to show the item in the browser window. Selecting a column will size the items in the tree map to the values in that column. Using shift+click will assign the values as colors.
This add-in shows the underlying code model objects for a selected node in .NET Reflector. The menu item is registered under the "Tools" menu.
Code Search is an add-in for .Net Reflector that allows searching within the source code.
You can either search using plain text or using regular expressions like such as … (try).+(catch)?
You can search from the Assembly to the Function level, which means that you can't search within all loaded assemblies at the same
This provides a 'Create Shortcut' context menu item for creating a ‘code://’ shortcut on your desktop to the item you currently have selected. URI Shortcuts can be transmitted to anyone with Reflector, and the same .dll/.exe that you created a shortcut to. They can also be put on the clipboard by selecting the item and pressing Cntl Alt C
Jonathan de Halleux
Allows importing COM/OLE type libraries using Reflector's file menu. It lists the COM components for browsing and converts them into managed interop assemblies.
This is a C++/CLI language rendering module.
Deblector is an add-in that allows debugging from NET Reflector
Peter Sawatzki, Hallvard Vassbotn
This add-in extends Reflector with a Delphi language rendering module.
This add-in generates and manipulates Dependency Structure Matrices (DSMs) in order to untangle complex inter-module dependencies, Identify design violations and Identify cyclic dependencies
This add-in shows differences between two versions of the same assembly. If you select a Framework DLL in the tree node in the Reflector main window, and then choose Tools->Assembly Diff from the menu, it will display the Diff automatically. If you select anything else, you will need to select an assembly from an Assembly selection screen. The Diff utility will remember the match, and will always select that destination assembly when you next select the source assembly, up to 20 matches by default.
Doubler is a code generator (C# and VB.NET)for unit testing ,especially legacy code. It helps cleave dependencies apart, create test doubles, and write unit tests . It features a
- Recording Generator – Use against an abstract type. It will create a Recording Test Stub.
- Fake Generator - Use against an abstract type. It will create a Fake Object.
- Test Generator – Use against a concrete type. It will generate a unit test fixture and test methods for each public method on the test subject..
Enums provides a Bit Flag Converter for helping to determine which bits are turned on by providing an integer or vice versa. This addin also includes an Enum Viewer that is a custom enum disassembler (for VB and C# only) that allows the user to decide whether enum fields should be shown in alphabetical order or by value.
The Reflector.FileDisassembler can be activated from the Tools-File disassembler menu and is used to dump the decompiler output to files of any language supported by Reflector (e.g. C#, VB.NET, Delphi). This will then allow file-based searching or help to convert a class from one language to another.
This Add-In generates code and resource files for a selected assembly, module, namespace, or type. It also creates a VS project file to see the generated files in Visual Studio.
Jonathan de Halleux
This add-in draws assembly dependency graphs, IL flow graphs and class diagrams. Recommended.
HawkEye, a free tool for debugging the UI tree of Windows Forms applications, is able to use Reflector by means of an Add-in . If you select your element, and select ‘Show source code’ on the context menu, Hawkeye will immediately ask Reflector to show you the source code of the selected element, whether it is a field, property, event, method or class.
A Managed C++ language add-in for .NET Reflector.
The OpenZip addin makes it easier to add a dll/exe from a zip file into Reflector's list of assemblies. The addin places itself on the File menu with the other Open commands. When you choose it, a dialog will open allowing you to browse to a zip file. Once you have chosen a zip file, any dlls or exe's will show up in the list box allowing you to select it. Once you have selected all the assemblies you want to extract and add to Reflector, you can open it as usual.
Jonathan 'Peli' de Halleux
This add-in allows you to start the Pex wizard directly from Reflector. The wizard generates a suite of parameterized unit tests from any assembly. This suite can later be run through Pex to generate unit tests.
This provides an extra entry in the language list for Powershell. If selected, It will decompile the IL into Powershell
Jonathan de Halleux
This add-in translates the IL code of a given method into the C# code that would be needed to generate the same IL code using System.Reflection.Emit
Reflexil is an assembly editor and runs as a plug-in for Reflector. Using Mono.Cecil, written by Jb Evain, Reflexil is able to manipulate IL code and save the modified assemblies to disk. Reflexil also supports 'on the fly' C# and VB.NET code injection.
Jonathan 'Peli' de Halleux
This is a lightweight code annotation tool for Reflector that can be used during code reviews or API reviews to take notes and pass them to other project members. It stores the annotations in an XML-based Review file. These Review files can be merged.
Review files consist of code annotations. These consist of a list of changes. Each change consists of a comment, a date, a user, a status and resolution. To avoid losing any information, changes are written to disk after each 'commit'.
This allows editing, assign, or removing rules from a rule set in Windows Workflow Foundation
This Add-in will open an assembly or dependency from a process that is running on the system. The add-in adds a new menu to the Tools menu called “Open Running Assembly“. When you select it, the add-in displays a dialog that displays a list of managed processes running on the system. You can choose the process, or any managed assembly loaded in that process, and the selections will be loaded into Reflector.
Integrates Reflector into Resharper
This is a reflector addin using the WPF renderer to generate a sequence diagram or code flow
This is an add-in to the free SharpDevelop source-code editor. It opens NET Reflector directly from the SharpDevelop 221 and positions it on the selected code element. Reflector will load the required assembly and directly go to the selected method (or classes and other types of class members). This is now integral to the current SharpDevelop 3.0 so is no longer required
This add-in adds an item in the File menu to allow you to browse a Silverlight website and load assemblies from it.
This allows you browse of .NET assemblies within databases stored in a local or remote SQL Server 2005 instance, and download them directly into .NET Reflector
This is a Visual Studio add-in. Within Visual Studio, Right click and 'Test With... Reflector' to navigate to any code element inside Reflector. This works with methods, types, fields, events, enums and delegates.
Jonathan de Halleux
This is Peli's bid to use an Add-in to compute and visualize coverage, and inspire others to write Reflector Addins for code coverage visualization.
This is an Add-in that allows you to export an assembly to an XMI file that can then be imported into a variety of UML tools. Xmi4DotNet examines your assembly and exports XMI It is useful for exporting your code model into a UML package to simplify drawing.
Writing or modifying an Add-in.
Writing an Add-in, or modifying an Add-in, is reasonably easy, and will not tax any experienced .NET programmer. Because most of the Add-ins are available in source-code on CodePlex, one can get a long way by modifying these for particular requirements, or to change the interface to suit the way you work. There is also Jason Haley’s great resource for Add-In writers, that includes templates and walkthroughs to make the work even easier. He includes easily-followed instructions on getting started. Lutz has even provided a ‘Hello world’ add-in to get started with. If you write anything that could be of use to another .NET Reflector users, then please add it to the Codeplex archive
This article has been viewed 252 times.
Author profile: Andrew Clarke
Andrew Clarke has been developing software applications for over 25 years. He is a database expert, but has a particular interest in website-publishing and ECommerce. He recently worked with the first two winners of the 'Apprentice' program at Amstrad, creating various business applications, and since worked with Tim Campbell setting up the 'Bright Ideas Trust'. He also subedits and reviews articles for Simple-Talk.