Open Source Alternatives to Reflector? [closed]
Asked Answered
P

10

419

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:

  1. Common Compiler Infrastructure (CCI)
  2. Mono Cecil
  3. ILSpy
  4. dnSpy (fork of ILSpy, project appears more active than original)
  5. Dotnet IL Editor (DILE)
  6. IL.View
  7. 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.
Polyphony answered 11/3, 2010 at 15:0 Comment(2)
FYI, there's now a version of v6 that'll be free indefinately: eon.businesswire.com/news/eon/20110426007021/en/.NET-Reflector/…Dugaid
possible duplicate of Something Better than .NET Reflector?Froufrou
A
31

2 options I know of.

  • CCI
  • Mono Cecil

These wont give you C# though.

Argument answered 11/3, 2010 at 15:20 Comment(3)
Leppie, thanks. I'm accepting this as the answer, even though it was a tough choice between your answer and Jason Haley's.Polyphony
CCI does not have a GUI front-end (that I'm aware of). But in the current source in codeplex there is a pretty simple API to convert the decompiled AST into C#, fyi.Samadhi
Mono.Cecil is just a library, right?Elene
P
174

Updated 13th December 2011

The following open source tools are available:

Polyphony answered 11/3, 2010 at 15:49 Comment(9)
I used dile a few years ago - it is a great disassembler AND debugger - I highly recommended it back when I was using it. I haven't used it for awhile though.Monoculture
The current version of ILSpy (ILSpy v1.0.0.440, 20010228) is working like I expected it to be. I can browse methods, properties and even source code for a C# lib without the PDB file.Servo
Just started using ILSpy. Very happy with it so far. Perfect replacemenet. Thank you SharpDevelop!Klong
Just came across this tool, very happy to see a replacement for a staple in the .NET developer's tool belt. Some of the decompilations are a little weird (string concatenation shows up as IL would see it, but not necessarily as the code was written - not a bad thing), but overall, a great tool!Botch
I just tried ILSpy and it works great! It even reconstructs lambda expressions and iterator ("yield return") methods... wow! I am impressed!Cheriecherilyn
ILSpy.....just tried. Works very well :)Trapp
From what I can tell, ILSpy doesn't have the "analyze" function that shows "depends on" and "used by" links for an assembly. Is that missing, or am I just not looking in the right place?Camboose
@Camboose Right click the property/method/etc. and you should see the option.Interweave
The reason I dont like ILSpy is that it looks so cluttered, with no line breaks even between methods and fields. dotPeek or JustDecompile looks so easy on eyes.Reflation
I
37

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.

Ipecac answered 11/6, 2011 at 7:25 Comment(8)
Great tool, but not open source. It is free, however, which may mean it steals the spotlight from any opensource equivalent.Tidwell
Ferdinand, -1 for a closed source tool. You should try adding this to one of the linked questions for Reflector.Polyphony
I'm leaving my answer here to make the information more complete. This thread is the easiest to find by google and also the list of other tools here is the most complete. (Not all of them are OSS btw.)Ipecac
Ferdinand, I have consistently downvoted all answers that give closed source solutions, updated the question text repeatedly to specify that I'm interested in OSS only, and made sure that all solutions in the question summary are open source. There is only one other closed source solution in this question thread, which I have also downvoted. This question was asked before the Redgate decision to charge back earlier this year and specifically asks for open source alternatives. What more do I need to do?Polyphony
@MagicAndi Stop complaining would be a start. I found this thread from Google while looking for a free alternative. I couldn't care less if it's open source or not. @Ferdinand thanks for the dotPeek link, looks promising.Cleotildeclepe
@MagicAndi: Editing the question to remove your tirade against closed source and linking to the question where you feel they should be listed instead would be a good start. That will satisfy the "I found this from google" complainers. And saying "A list of closed-source free tools can be found here, but I fear they may not stay free" would be fine, as it explains your rationale for asking specifically for OSS. But don't condemn others willing to use closed source tools.Fumikofumitory
@WinstonSmith: This is Andi's question, and free-as-in-beer tools are not correct answers to a question asking about free-as-in-freedom alternatives.Fumikofumitory
Ben, thank you for your contribution. You're probably right about the question intro - I'll update accordingly. But the other relevant questions are already linked by StackOverflow in the Linked and Related sections on the RHS.Polyphony
A
31

2 options I know of.

  • CCI
  • Mono Cecil

These wont give you C# though.

Argument answered 11/3, 2010 at 15:20 Comment(3)
Leppie, thanks. I'm accepting this as the answer, even though it was a tough choice between your answer and Jason Haley's.Polyphony
CCI does not have a GUI front-end (that I'm aware of). But in the current source in codeplex there is a pretty simple API to convert the decompiled AST into C#, fyi.Samadhi
Mono.Cecil is just a library, right?Elene
I
15

Telerik today released a Beta of their own decompilation tool, JustDecompile. Closed source, but free and looks promising.

Inunction answered 2/5, 2011 at 17:10 Comment(5)
Ray, apologies, but to be consistent with the approach to the GrayWolf answer, I'm going to have to downvote this answer. This question is specifically for Open Source alternatives. The .NET community allowed itself to get into this mess by relying on a closed source solution; we should avoid this in the future, regardless of who is providing the tool. -1Polyphony
Ray, turns out my Kaliro suggestion is also a closed source utility. Please feel free to reciprocate the downvote - I deserve it! Unfortunately, you can't vote on your own answers, either up or down.Polyphony
@MagicAndi - It would be easier to delete your answer than to downvote it. If you don't feel it adds any value then you have the power to make "be gone".Discomposure
Don't remove/downvote this answer. Other SO questions about free alternatives are being closed as "duplicates" of this question by moderators! so the info's worth being here.Discursion
JustDecompile is a shamefully buggy application that crashes all the time and shows a lot of exceptions where code should be. Apart from that is it very slow. .NET Reflector is MUCH better than that crap!Hardening
D
12

ILSpy works great!

As far as I can tell it does everything that Reflector did and looks the same too.

Deterioration answered 13/7, 2011 at 18:16 Comment(0)
M
10

Actually, I'm pretty sure Reflector is considered a disassembler with some decompiler functionality. Disassembler because it reads the bytes out of an assembly's file and converts it to an assembly language (ILasm in this case). The Decompiler functionality it provides by parsing the IL into well known patterns (like expressions and statements) which then get translated into higher level languages like C#, VB.Net, etc. The addin api for Reflector allows you to write your own language translator if you wish ... however the magic of how it parses the IL into the expression trees is a closely guarded secret.

I would recommend looking at any of the three things mentioned above if you want to understand how IL disassemblers work: Dile, CCI and Mono are all good sources for this stuff.

I also highly recommend getting the Ecma 335 spec and Serge Lidin's book too.

Monoculture answered 12/3, 2010 at 0:4 Comment(2)
this link seems downCatchy
Yeah, sorry I took that site down last year and haven't replaced it.Monoculture
P
8

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.

Peplum answered 4/2, 2011 at 14:8 Comment(0)
J
5

Well, Reflector itself is a .NET assembly so you can open Reflector.exe in Reflector to check out how it's built.

Jandy answered 11/3, 2010 at 15:2 Comment(10)
No, you can't. Reflector is obfuscated.Craving
Andrew, -1. Reflector has been obfuscated for a number of years, possibly since it's initial release.Polyphony
You can't open Reflector in Reflector? I just did it - obfuscation simply hurts the readability of the IL since identifiers and type names are mangled but that doesn't mean that you cant dissasemble it.Jandy
Andrew - when in a hole, stop digging...Polyphony
Well, I think most of us don't speak IL currently... and you can't see the equivalent C# code, it says "// This item is obfuscated and can not be translated."Fimbriate
Hmm... I have version 5.1.6.0 and I can see the source just fine - only the identifier names are obfuscated. Not perfect yes, but I am looking at the C# source of Reflector right now. :)Jandy
Andrew, no one is disputing the fact that you can open the Reflector assembly using the Reflector tool. What everyone, apart from yourself, agrees on is that it is unreadable when you do so.Polyphony
@MagicAndi - I am not trying to be argumentative, I am just trying to help you by providing a solution to your problem (even though it may not be ideal).Jandy
@Andrew Hare: If you try to look at method implementations via reflector in reflector you will see "This is obfuscated" and it won't show it so no, you can't use Reflector. Besides, being pedantic about what the OP wants with the OP is a losing battle.Craving
Regardless of the ability to do so, it is probably against some clause in the license. It isn't that it does anything magical, it is that to create a tool that does similar things is hard work, and simply copying the code from or hacking the original tool is probably not going to be a legal option.Lindbergh
M
3

I am currently working on an open-source disassembler / decompiler called Assembly Analyzer. It generates source code for methods, displays assembly metadata and resources, and allows you to walk through dependencies.

The project is hosted on CodePlex => http://asmanalyzer.codeplex.com/

Melmela answered 20/5, 2011 at 18:36 Comment(0)
L
1

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.

Literate answered 11/3, 2010 at 15:17 Comment(4)
Uhm, if with "Reflection" you refer to "System.Reflection" of the .NET framework, I would very much doubt that.Pournaras
@Christian.K: No, Reflector does not use System.Reflection in the framework, Roeder stated as much very early on because of issues with assembly loading and unloading.Exothermic
@casperOne, I don't know exactly how .NET Reflector works internally, but the System.Reflection namespace has been extended since the early days of .NET Reflector. It now supports loading and unloaded assemblies in a reflection-only context: #225830Tidwell
@Drew Noakes: This is true, but Roeder never stated (to my knowledge) that he had moved back to Reflection once this change was made.Exothermic

© 2022 - 2024 — McMap. All rights reserved.