Just to ask if anyone knows of an open source alternative to RedGate's Reflector? I'm interested in checking out how a tool similar to Reflector actually works.
Note, if you know of a free but not open source alternative to Reflector, you can answer the following related question:
Summary - Updated 11th May 2011
A quick round-up of the various open source projects and tools that have been suggested:
- Common Compiler Infrastructure (CCI)
- Mono Cecil
- ILSpy
- dnSpy (fork of ILSpy, project appears more active than original)
- Dotnet IL Editor (DILE)
- IL.View
- Monoflector (no longer active as of April 2011)
The following resources may also be of interest:
- TypeView.cs
- Jason Haley's notes on disassembling .NET
- Adrian Bank's recent blog post summarising a number of Reflector alternatives, including several options not mentioned below.
- Mark Lichtenberg's detailed blog post comparing several of the open source alternatives (DILE, ILSpy and Mono Cecil using MonoDevelop) to Reflector.
Another replacement would be dotPeek. JetBrains announced it as a free tool. It will probably have more features when used with their Resharper but even when used alone it works very well.
User experience is more like MSVS than a standalone disassembler. I like code reading more than in Reflector. Ctrl+T navigation suits me better too. Just synchronizing the tree with the code pane could be better.
All in all, it is still in development but very well usable already.
The main reason I used Reflector (and, I think, the main reason most people used it) was for its decompiler: it can translate a method's IL back into source code.
On that count, Monoflector would be the project to watch. It uses Cecil, which does the reflection, and Cecil.Decompiler, which does the decompilation. But Monoflector layers a UI on top of both libraries, which should give you a very good idea of how to use the API.
Monoflector is also a decent alternative to Reflector outright. It lets you browse the types and decompile the methods, which is 99% of what people used Reflector for. It's very rough around the edges, but I'm thinking that will change quickly.
Well, Reflector itself is a .NET assembly so you can open Reflector.exe in Reflector to check out how it's built.
The Reflector tool uses Reflection.- apparently this is not correct.You asked for two things - code that shows what reflector does, and also an alternative to reflector.
Here's an example, much simplified from what Reflector does, but it shows the technique of reflection: TypeView.cs
I don't have a suggestion for an open-source Reflector replacement.