Click here to monitor SSC

Software Engineer - Red Gate Software

Some notes on Reflector 7

Published 1 February 2011 8:31 am

Both Bart and I have blogged about some of the changes that we (and other members of the team) have made to .NET Reflector for version 7, including the new tabbed browsing model, the inclusion of Jason Haley’s PowerCommands add-in and some improvements to decompilation such as handling iterator blocks. The intention of this blog post is to cover all of the main new features in one place, and to describe the three new editions of .NET Reflector 7.

If you’d simply like to try out the latest version of the beta for yourself you can do so here.

Three new editions

.NET Reflector 7 will come in three new editions:

  • .NET Reflector
  • .NET Reflector VS
  • .NET Reflector VSPro

The first edition is just the standalone Windows application. The latter two editions include the Windows application, but also add the power of Reflector into Visual Studio so that you can save time switching tools and quickly get to the bottom of a debugging issue that involves third-party code.

Let’s take a look at some of the new features in each edition.

Tabbed browsing

.NET Reflector now has a tabbed browsing model, in which the individual tabs have independent histories. You can open a new tab to view the selected object by using CTRL+CLICK. I’ve found this really useful when I’m investigating a particular piece of code but then want to focus on some other methods that I find along the way. For version 7, we wanted to implement the basic idea of tabs to see whether it is something that users will find helpful. If it is something that enhances productivity, we will add more tab-based features in a future version.

image

PowerCommands add-in

We have also included Jason Haley‘s PowerCommands add-in as part of version 7. This add-in provides a number of useful commands, including support for opening .xap files and extracting the constituent assemblies, and a query editor that allows C# queries to be written and executed against the Reflector object model .

All of the PowerCommands features can be turned on from the options menu. We will be really interested to see what people are finding useful for further integration into the main tool in the future.

image

My personal favourite part of the PowerCommands add-in is the query editor. You can set up as many of your own queries as you like, but we provide 25 to get you started. These do useful things like listing all extension methods in a given assembly, and displaying other lower-level information, such as the number of times that a given method uses the box IL instruction.

image

These queries can be extracted and then executed from the ‘Run Query’ context menu within the assembly explorer.

image

Moreover, the queries can be loaded, modified, and saved using the built-in editor, allowing very specific user customization and sharing of queries.

image

The PowerCommands add-in contains many other useful utilities. For example, you can open an item using an external application, work with enumeration bit flags, or generate assembly binding redirect files. You can see Bart’s earlier post for a more complete list.

.NET Reflector VS

.NET Reflector VS adds a brand new Reflector object browser into Visual Studio to save you time opening .NET Reflector separately and browsing for an object. A ‘Decompile and Explore’ option is also added to the context menu of references in the Solution Explorer, so you don’t need to leave Visual Studio to look through decompiled code. We’ve also added some simple navigation features to allow you to move through the decompiled code as quickly and easily as you can in .NET Reflector.

image

When this is selected, the add-in decompiles the given assembly,

image

Once the decompilation has finished, a clone of the Reflector assembly explorer can be used inside Visual Studio.

image

When Reflector generates the source code, it records the location information. You can therefore navigate from the source file to other decompiled source using the ‘Go To Definition’ context menu item.

image

This then takes you to the definition in another decompiled assembly.

image

.NET Reflector VSPro

.NET Reflector VSPro builds on the features in .NET Reflector VS to add the ability to debug any source code you decompile. When you decompile with .NET Reflector VSPro, a matching .pdb is generated, so you can use Visual Studio to debug the source code as if it were part of the project. You can now use all the standard debugging techniques that you are used to in the Visual Studio debugger, and step through decompiled code as if it were your own.

Again, you can select assemblies for decompilation.

image

They are then decompiled.

image

And then you can debug as if they were one of your own source code files.

image

The future of .NET Reflector

As I have mentioned throughout this post, most of the new features in version 7 are exploratory steps and we will be watching feedback closely. Although we don’t want to speculate now about any other new features or bugs that will or won’t be fixed in the next few versions of .NET Reflector, Bart has mentioned in a previous post that there are lots of improvements we intend to make. We plan to do this with great care and without taking anything away from the simplicity of the core product.

User experience is something that we pride ourselves on at Red Gate, and it is clear that Reflector is still a long way off our usual standards. We plan for the next few versions of Reflector to be worked on by some of our top usability specialists who have been involved with our other market-leading products such as the ANTS Profilers and SQL Compare. I re-iterate the need for the really great simple mode in .NET Reflector to remain intact regardless of any other improvements we are planning to make.

I really hope that you enjoy using some of the new features in version 7 and that Reflector continues to be your favourite .NET development tool for a long time to come.

Leave a Reply