ILSpy - open source.NET assembly browser, decompiler and software utility for Microsoft .NET combining class browsing, static analysis, and decompilation. Tool for code internal assemblies code analyzes or reflector tool for our applications to improve the performance or to know the internals of the assembly we have created. I was using Red Gate .NET Reflector earlier for same as it was free and with frequent updates. Now Red Gate has made that tool paid (about 35$) version so I found alternative tools from that I can see IL and C# code easily for free. Why do we need to pay money if we can develop an open source product like ILSpy? That decompiler tool almost giving the same functionalities as .NET Reflector.
The new ILSpy GUI is written in WPF and reuses a few SharpDevelop components - the tree view is SharpTreeView, written by Ivan Shumilin for the SharpDevelop WPF Designer outline view.
IL Spy Features list
- Assembly browsing
- IL Disassembly
- Decompilation to C#.
- Supports lambdas and 'yield return'
- Shows XML documentation
- Saving of resources
- Search for types/methods/properties (substring)
- Hyperlink-based type/method/property navigation
- Base/Derived types of navigation
- Navigation history
- BAML to XAML decompiler
- Save Assembly as C# Project
- Find usage of field/method
- Extensible via plugins (MEF)
ILSpy doesn’t have the same plugin system and some of the reflected code looks still has a lot of IL looking code in it (goto statements, etc.), but for such a new tool, it works tremendously!!! For example, in next screenshot, we can see how yield operator was parsed.
Event it’s provide IL and C# mode also so you can see what’s going on internally on top its having button like this:
My friend Denis Markelov developed cool plugin for IL Spy for free ILSpy Visualizer. All found issues, new feature requests or desired changes to the existing features you can share either through a project's GitHub page, or via an e-maildenis@denismarkelov.com.
To use a plugin, download the build and put the assembly into the folder where ILSpy.exe is located. After that context menu for assemblies in the ILSpy tree will contain new item - Browse Assembly. Currently, it contains one component, called Assembly Browser. Its intention is to show type hierarchies in a convenient for the viewer way. Screenshots below will give you an idea of the plugin's capabilities.
References:
ILSpy Plugins
Wiki ILSpy
ILSpy Visualizer - a plugin for better assemblies visualization.
Summary:
I may not use .NET Reflector every day but I use it enough to miss it. Probably enough to pay for it, but I won’t be supporting RedGate! Of course free is better. As you can see ILSpy easily reflects .NET code giving you excellent decompilation of the source files. If you are interested in contributing join ILSpy in #sharpdevelop (on Freenode). Happy programming...