SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Christian Hornung

Reflector AddIn Released

The new Reflector AddIn for SharpDevelop has been released. It has been integrated into the SharpDevelop 3.0 tree in build 3249 and it is also available for download for SharpDevelop 2.2.1.

The Reflector AddIn provides the ability to open Lutz Roeder's free .NET Reflector directly from the source code editor and position it on the selected code element.

For those who do not already know Reflector, it is an excellent .NET assembly browser and also a disassembler and decompiler for various .NET languages. It really comes in handy when you are working with a poorly documented library, for instance.

Decompilation example

I recently wanted to make use of the SharpSvn library which is essentially a managed wrapper for the Subversion client API. During development I came across the following situation:

Now there is obviously no documentation available for the GetStatus method, and I do not want to go and download the whole source code either. But I would like to know whether the "statuses" collection can be null when that method returns. So what can we do? Open Reflector. The Reflector AddIn provides that command in the refactoring context menu:

When you select that command, Reflector will be started up automatically if it is not running. Then Reflector will load the required assembly and directly go to the selected method (of course this is also supported for classes and other types of class members):

Now we want to see the code. Press space bar (or select "Disassemble" from the "Tools" menu). There it is:

Now we can see that the "items" variable is always initialised and assigned to the out parameter in question within the finally block. This means that we will never get a null value.

Of course you can also use the combo box at the top where it says "C#" in the screenshot to change the output to your favourite .NET language. Reflector currently supports C#, VB.NET, Delphi, Managed C++ , Chrome and raw IL out of the box.

The "Open .NET Reflector" command is also available through the class and class member bookmarks on the left margin of the source code editor and also through the context menu in the class browser of SharpDevelop:

First-time configuration

When you use the Reflector AddIn for the first time, you have to tell it where to find Reflector. For this purpose, the following dialog will pop up:

There you can also find the download link for Reflector in case you do not have it already. Then you have to click the Browse button and locate Reflector.exe.

As soon as you click OK, the location is saved. This dialog will automatically reappear if the add-in can no longer find Reflector.exe at the saved location.

Please note that SharpDevelop must have write access to the directory containing Reflector.exe because it has to copy some files there and modify the configuration of Reflector to load them automatically on startup. This is needed so that Reflector exposes a remoting service which SharpDevelop can connect to.

More Reflector functionality

Reflector can also list all the callers of a method, property etc. and all code elements that are in use by a certain member. This function is available through "Tools" -> "Analyze":

Reflector itself also has its own add-in architecture and a great variety of add-ins is available. For example, there are add-ins which can draw class diagrams, sequence diagrams or dependency graphs.

Download for SharpDevelop 2.2.1

The Reflector AddIn for SharpDevelop 2.2.1 is available for download on my web site:
http://dev.hornung.dynalias.com/reflector-addin-for-sharpdevelop/download.html

Comments

 

Reflective Perspective - Chris Alcock » The Morning Brew #148 said:

Pingback from  Reflective Perspective - Chris Alcock  » The Morning Brew #148

July 31, 2008 9:28 AM
 

gOODiDEA.NET said:

Web Top scalability mistakes Ajax-Alexa-Thumbnails: API to get site thumbnails Javascript Event onJSReady

August 1, 2008 1:56 AM
 

Recent Faves Tagged With "reflector" : MyNetFaves said:

Pingback from  Recent Faves Tagged With "reflector" : MyNetFaves

October 19, 2008 3:02 AM
 

LemurSoft :: Using .NET Reflector Add-ins - link said:

Pingback from  LemurSoft   ::  Using .NET Reflector Add-ins - link

November 21, 2008 8:50 PM
 

LemurSoft :: A flexible charting library for .NET said:

Pingback from  LemurSoft   ::  A flexible charting library for .NET

November 22, 2008 10:21 PM
 

LemurSoft :: Great site with comparative examples of SilverLight and Flash said:

Pingback from  LemurSoft   ::  Great site with comparative examples of SilverLight and Flash

December 16, 2008 12:39 AM
 

SharpDevelop | portella.com.br said:

Pingback from  SharpDevelop | portella.com.br

February 11, 2009 1:05 AM
 

Gabriel Amorim said:

A comunidade do SharpDevelop liberou a aproximadamente 1 mês a versão 3.0 da IDE .NET open source. O

March 30, 2009 3:16 PM
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.