Tags: , , | Posted by Kevin Babcock on 5/15/2009 11:52 AM | Comments (3)

I’m a big fan of developer tools. In fact, without the right tools our lives as software developers would be much more frustrating and less productive. So I’d like to start a weekly series of posts in which I’ll provide give a tip or two on how to get the most out of our development tools. Most of the tools I plan to feature are tools that I use for my own development, but if you’d like me to cover a specific tool then by all means send me your suggestions.

This week I want to give a quick overview of what I consider to the most important tool (besides Visual Studio) a .NET developer could ever add to his/her arsenal, .NET Reflector. Originally created by Lutz Roeder, Reflector is now in the care of Red Gate Software, who will handle all its future development. This handy tool lets you explore, browse, and analyze any .NET assembly in the language of your choice. That means you can crack open and peek inside any .NET Framework assembly to see how a particular class or method is implemented, as well as any of your own assemblies. Reflector is a standalone executable, meaning no installation is necessary. To get started, head to the web site and download a copy.

When you first launch Reflector, you’ll be asked to select a default version of any .NET Framework components installed on your machine. In the image below, you can see that I have .NET Framework v2.0 – v3.5, .NET Compact Framework v2.0 – v3.5, and Silverlight 2.0.

choose a default framework version when starting .NET Reflector

Once you select a Framework version, all of its assemblies will be listed in an easily navigable tree. Expand each assembly to browse its contents. Each assembly organizes its content by namespace, class, then class members in alphabetical order.

browse assembly contents in .NET Reflector

To view the contents of a particular class, right-click on the class and select Disassemble from the context menu. Alternatively, you can select Tools | Disassemble from the menu.

disassemble an assembly in .NET Reflector

The disassembled class will be displayed in a new section to the right of the assembly tree. By default, all methods are minimized, but you can easily expand them by clicking on a the method you want to view or selecting the Expand Methods link at the bottom of the window.

browse a disassembled class in .NET Reflector

You can also navigate through classes and properties by selecting them in the disassembler window. To navigate back and forward to previous selections, simply use the navigation buttons beneath the main menu. If you’d like to view the disassembled class in another language, select the language dropdown list and select your language of choice. Five options are available: MSIL, C#, VB, Delphi, MC++, and Chrome.

change the language in which a disassembled assembly is displayed in .NET Reflector

If you can’t find the assembly, class, or class member you are after by using the assembly browser, you can search for content by clicking on the magnifying glass below the menu and typing the name of the member in the search box. A list of matches will be displayed in the window below as you type. Simply select the item you want to navigate to it in the assembly browser.

search for a class or member name in .NET Reflector

If you want to browse your own or third-party assemblies, you can do so by selecting File | Open from the menu and navigating to the folder where the assembly resides. Once you have opened the assembly, you can browse, search, or disassemble it just like you would any Framework assembly. In the example below, I’ve opened up the latest version of Telerik’s RadControls for ASP.NET AJAX.

open and browse a new assembly in .NET Reflector

Finally, a cool feature of .NET Reflector is that it remembers your settings. If you open your own assemblies or customize any options and then close out of Reflector, those changes will not be lost when you re-launch the tool.

Conclusion

.Net Reflector is an invaluable tool for developers wanting to dive into and learn about the intricacies of the .NET Framework, or any other .NET assembly. Give it a try if you’re not using it already, and stay tuned next week as I go into some more advanced features of this great developer tool.

Comments

Chris Pietschmann on 5/15/2009 4:56 AM It still surprises me that Microsoft didn't get the rights to Reflector from Lutz Roeder and include it in the .NET Framework SDK and with Visual Studio. It's such an important tool for any .NET developer!!

I started using it back in 2003, WAY before MS even thought about releasing the source code for .NET and it let me peak in at what .NET was doing and why. This tool is such an incredible help! I hope Red Gate paid Lutz a bunch of money for it!
Kevin on 5/15/2009 12:47 PM Could you review any tools you find helpful for web development in IE?  I just find that the IE Web Developer toolbar is no comparison to Firebug, and Expression Web Superpreview doesn't work on sites that require authorization.
Kevin Babcock on 5/16/2009 4:49 PM @Chris: I'm not sure what Lutz's motivation was behind handing Reflector over to Red Gate (other than wanting to work on other project).

@Kevin: I use Web Developer Helper for IE, but I'll keep my eyes peeled for other IE web developer tools.

Add comment




biuquote
  • Comment
  • Preview
Loading