ReSharper 6 Bundles Decompiler, Free Standalone Tool to Follow

Previous posts introducing ReSharper 6:

What’s going on here?

We’ve recently hinted on a new kind of functionality that’s being developed within ReSharper 6 EAP. Those of you who saw that post got the message right: ReSharper 6 will feature a decompiler. More than that, it is already available in ReSharper 6 EAP builds that you can download and try.

As if it isn’t enough, we have more great news: make sure to read on to the end of this post.

How do I invoke the decompiler in ReSharper?

There are several ways you can navigate to decompiled code in ReSharper:

  1. You can navigate to a decompiled library symbol right from its usage in the source code. This should be done via ReSharper’s Navigate To feature. To invoke Navigate To, press Alt+` and select Decompiled sources:
  2. You can jump to the declaration of a specific library type from anywhere within Visual Studio using ReSharper’s Go to Type menu (Ctrl+T in Visual Studio layout). You can even go further by jumping to a specific library method or property using Go to Symbol (Shift+Alt+T).
  3. If you prefer browsing library types using the Object Browser, you can invoke Navigate To Decompiled Sources right from there:
  4. Will common ReSharper features be available with decompiled code?

    Well naturally, you can’t refactor decompiled libraries, generate new code in them, or run code inspections (though it would be fun in some cases).

    However, most navigation features that ReSharper normally provides in source code are equally available in decompiled code. For example, you can:

    • Navigate to declarations and implementations:
    • Search for usages, inheritors, and base symbols:
    • Explore a decompiled type with File Structure:
    • View type hierarchy or even see incoming calls to library symbols from your source code:
    • Highlight usages of symbols:

    Where can I configure the behavior of ReSharper decompiler?

    Decompiler is configured in the same group as other features from the External Sources feature group, namely ReSharper | Options | Tools | External Sources | Decompiled Sources.

    If you’re trying to get ReSharper show decompiled code but it’s failing to do so, make sure that Decompiled sources is selected as an external sources data provider in ReSharper | Options | Tools | External Sources. By the way, if Decompiled sources is at the top of the list, you can navigate to decompiled code with Go to Declaration (F12 or Ctrl+click).

    How sophisticated is ReSharper decompiler?

    Let’s just say, ReSharper decompiler is sophisticated enough to correctly infer lambda expressions and yield returns. Some things are not yet supported, for instance auto-properties, but that’s only a question of time.

    Why has ReSharper moved in this direction?

    Source code management has been in focus of the developer community for ages. We have lots of source code storage systems with histories and branches, distributed and personal, tools ecosystem, and what not. However, many applications are quite large today, and handling them in source form tends to get more and more complicated. Setting up binary reusable libraries even inside a single business entity can be a very painful thing to perform.

    ReSharper started assisting developers with this in version 5, by introducing navigation to and within external sources. The External Sources feature brings code available through information in PDB (Program DataBase) files straight into Visual Studio editor. For example, when Microsoft releases another library in Reference Source form, they publish PDB files having links to their Source Servers. ReSharper can parse this information, download source files and display them for a developer to explore.

    That’s cool, but what about home-built libraries? What if your company doesn’t have Source Server infrastructure in place and doesn’t want to invest into getting one? How to get seamless integration with source code and binary libraries referenced in projects?

    That’s exactly the task that the decompiler in ReSharper 6 is going to solve. Adding to the Source Server support, the new ReSharper reconstructs source code from compiled assemblies and enables all code reading features in such files.

    Say, one department in your company builds a framework, and another department uses it to create an end-user application. You can reference assemblies for the framework and avoid bloating your workspace with files and projects that you don’t really need. However, when required, you can easily jump into decompiled sources and explore internals. Should you need further details — comments, real variable names, exact code — you can go and check out sources for that project, but in fact it is quite rarely needed.

    Another point is the emerging market of packaging solutions: NuGet and OpenWrap to name a few. Packages (or wraps) contain binaries and tools, but not source code. However, many of them are open source and it is perfectly legal to look for sources, even reconstructed. We would like to talk to providers of packaging solutions and ask them to include information about source code locations into package descriptors, so that everybody can get the exact source code for a specific version of binaries.

    Will the decompiler be only available as a part of ReSharper?

    At this point you are probably asking yourself “Well, but what about a standalone solution? I don’t need ReSharper!”.

    Bad news is you should only not need ReSharper if you’re not doing .NET development.

    Good news is that we’re preparing a standalone binary-as-a-source application, i.e. a decompiler + assembly browser to explore whatever .NET compiled code is legal to explore. We don’t have any specific date for release, but it’s going to be released this year, and it’s going to be free of charge. And by saying “free”, we actually mean “free”.

    UPDATE (May 12, 2011): Standalone decompiler called dotPeek is now available for download!

    If you’ve read it up to this point, you completely owe it to yourself to try ReSharper 6 EAP builds with decompilation engine right now!

    Let us know what you think about the quality of the decompiler and overall source-binary integration experience and how we can make it even better for you.

This entry was posted in How-To's, News and Events and tagged , , . Bookmark the permalink.

72 Responses to ReSharper 6 Bundles Decompiler, Free Standalone Tool to Follow

  1. Andrey Shchekin says:

    “We would like to talk to providers of packaging solutions and ask them to include information about source code locations into package descriptors, so that everybody can get the exact source code for a specific version of binaries.”

    Yes! This kind of metadata could be _extremely_ useful. And not only for navigation — just imagine finding a bug in github library and doing fork+submodule directly from VS to fix it.

  2. Dan Stiglick says:

    Happy to see R# go this way!!! Wicked news guys. So, that means this isn’t you guys – http://www.keepdecompilingfree.com/ – I totally thought it was a jetbrains site. I guess someone else is in too :-)

  3. Sean Kearon says:

    Really good news, and great timing!

    As for the point about embedding the source location into packaging solution – that would be an absolute killer feature, totally the best! Only today I wanted to avoid having to use ILMerge in my build and went to download NLog’s source. I was going to use Stovell’s Tape to elegantly embed it into the code I was working on. Trouble was, I was not sure of how to get the source for the version I was using. Now, wouldn’t it be just great to be able to get that from the package?

    Can’t wait to see how this goes…

  4. John Stead says:

    Will it decompile resources (e.g. XAML) as well?

  5. @John
    It hopefully will but not right now.

  6. Diego says:

    “Why has ReSharper moved in this direction?”

    A: Because your main competitor made his previously-free decompiler paid, which opens a great business opportunity.

    C’mon guys, everybody knows it, we won’t think less of you because of that :-D

  7. Roland says:

    OMG, I posted a comment regarding standalone tool 2 days ago :) in your previous post and now it happens :) awesome. Bye bye reflector.

  8. Kenneth Siewers Møller says:

    “And by saying “free”, we actually mean “free”.”
    Not that I don’t believe you, but wasn’t that the almost exact same statement issued by RedGate when they bought Reflector?
    I don’t really care for a free tool, as I am a happy ReSharper user, but a lot of developers will. If parts of ReSharper is going to be available as a free tool, I guess I’m paying for the development of that free tool through my ReSharper license (which I happily will do).
    RedGate should have chosen the same model for Reflector (may it rest in peace).

  9. Will says:

    It doesn’t seem to be able to decompile assemblies that were compiled from C++ (C++/CLR, not native code). Is that a known problem, or should I file a bug?

  10. @Diego
    The move by the competitor certainly helped but you can’t create a decompiler in a month, right? This is something we’ve been planning and preparing for a long time.

    @Kenneth
    That would be the most stupid decision ever. Unless the JetBrains management goes nuts (and since the management is smart and we’re not a public company, chances are slim), it won’t happen.

  11. Joe White says:

    In the past, JetBrains offered another free tool, the ReSharper unit-test runner. That product was quietly killed off a few years ago. It had to integrate with Visual Studio, which was a moving target — a standalone decompiler likely won’t be as big a drain on your resources to maintain. Still, it’s something to think about.

    As you get closer to releasing a free decompiler, it would be good to hear what level of commitment you’re able to put behind the free version. If you can’t promise much, that’s fine by me — but I want to know what to expect. RedGate never respected their users enough to communicate with them. I’ll be expecting more from you guys. :-)

  12. Sergey Kuks says:

    @Will
    No, this is not a known issue. It would be great to have an issue filed. If you’re able to attach a sample library we fail to decompile it would be terrific. Thanks in advance.

  13. Quooston says:

    Check out : http://www.symbolsource.org/. Bake it in!!!

  14. Kyralessa says:

    Is that “free” as in “free”, or “free” as in “cross our heart, hope to die, stick a needle in our eye, promise it’s free” free?

  15. Will says:

    @Sergey – Done. When I looked closer when filing the bug report, it turns out that it could decompile one class, though it was gibberish, but couldn’t decompile another. Anyway, it’s all in the bug report.

  16. @Kyralessa
    It’s free as in “we have other ways to earn money, so if the community is used to having a decompiler for free, why not give it to them for free?”

  17. @Joe
    At this point, we’re not committing to anything except that the tool is going to come out, and it’s going to be free. Let’s see how it goes. However, since the core is shared with ReSharper, we’re not expecting the free tool to lag behind.

  18. cave says:

    “Bad news is you should only not need ReSharper if you’re not doing .NET development.”
    +1

  19. Gordon Freeman says:

    Ah this word and it’s meanings…
    Did you mean free as in free beer or free as in free speech?

    Anyway, it’s a great job you’re doing.

    By the way, I was meaning to ask: can I assume that if I buy a Resharper 5 license today I will get a free update for the version 6 when it comes out?

  20. David Hanson says:

    Outstanding work guys. Been a long time resharper user and know this will be quality. :)

  21. Excellent news. I was hoping for announcement like this after the sorry news coming out of the Red-Gate corner.

  22. @Gordon
    Free beer for sure.

    As to license purchase, no, buying ReSharper today doesn’t give you a free upgrade to version 6. We normally announce free upgrade campaigns ~1 months prior to release, and we’re not there yet.

  23. Greg says:

    What a move! Love you guys. Of course, I love Red Gate’s tools too, but their recent move on Refactor, based on their earlier promise (or at least implied promise), really ticks me off. Nice job. This will likely lead to the death of a great, long used and perhaps the most widely used .NET tool, Refactor.

  24. Doug Wilson says:

    At long last I will no longer need any RedGate tools! Good bye RedGate. I won’t miss you at all.

  25. Halstein Tonheim says:

    Would it be possible to debug into decompiled code?

  26. FYI – If you have Team Foundation Server 2010, you can get the proper Symbol Server & Source Server setup for internal use in your organization. This really helps with having shared libraries that are used internally by different teams.

    Find out more here: http://www.edsquared.com/2011/02/12/Source+Server+And+Symbol+Server+Support+In+TFS+2010.aspx

  27. Omer Raviv says:

    The examples of looking for all classes derived from say, “Exception” bring up the need to have some checkbox or something to quickly enable/disbled decompiled sources (in case I just want my own exceptions, not every exception in the framework!). Will there be such a thing built into the usual Find Usages/Go to Implementors/etc etc.. interfaces?

  28. @Halstein
    Unfortunately no, we’re not planning this

    @Omer
    First of all, you don’t actually need a decompiler to find implementations of .NET Framework types: you could as well find them from metadata, for example.
    We’re not planning a “hot switch” to turn decompiled sources on/off directly from the UI of Find Usages, Go to Implementation and other navigation features but what you can do in this case is when you search for implementations of System.Exception, you can drop search results into the Find Results window by pressing “+” or clicking the “Show in Find Results” button in the pop-up, and then group search results in a way that lets you easily distinguish between implementations in libraries and in source code. I’d say grouping by “Project and Type” is the best option for this task.

  29. Joe Gershgorin says:

    Will the decompiling engine support browsing internal static types that there’s no pdb for?

  30. Halstein Tonheim says:

    Too bad since Reflector Pro makes it possible to debug into decompiled code. However, as a software developer myself I understand you can’t implement everything all at once. Put it in 6.1 and I will be happy! ;)

  31. Jon Rista says:

    This sounds like excellent news…the community really needs an alternative to Reflector. I have used Reflector for many, many years…almost since Lutz first released it, and I am very upset that RedGate reneged on their PROMISE to the .NET community to keep it free. I don’t see any reason why RedGate needs to charge for the tool, as they make plenty of money off the rest of their products, and Reflector doesn’t need much work (if anything outside of updates for new CLR/Framework versions).

    I’ve downloaded the ReSharper 6 EAP and given it a try. While it is great to be able to see code when a .PDB is available, the results when a .PDB is NOT available are actually very disappointing. The “decompilation” does nothing more than what was already possible with Visual Studio…all you get is the interface of a class, NOT its implementation. This is in no way representative of Reflector’s functionality, which quite literally DECOMPILES code and presents you with full implementation (even if the variable names are not the same.) This is no better than browsing the class from the Object Browser. Here is an example of ‘decompiling’ the log4net LogManager class:

    public sealed class LogManager
    {
    public static ILog Exists(string name);
    public static ILog Exists(string repository, string name);
    public static ILog Exists(Assembly repositoryAssembly, string name);
    public static ILog[] GetCurrentLoggers();
    public static ILog[] GetCurrentLoggers(string repository);
    public static ILog[] GetCurrentLoggers(Assembly repositoryAssembly);
    public static ILog GetLogger(string name);
    public static ILog GetLogger(string repository, string name);
    public static ILog GetLogger(Assembly repositoryAssembly, string name);
    public static ILog GetLogger(Type type);
    public static ILog GetLogger(string repository, Type type);
    public static ILog GetLogger(Assembly repositoryAssembly, Type type);
    public static void Shutdown();
    public static void ShutdownRepository();
    public static void ShutdownRepository(string repository);
    public static void ShutdownRepository(Assembly repositoryAssembly);
    public static void ResetConfiguration();
    public static void ResetConfiguration(string repository);
    public static void ResetConfiguration(Assembly repositoryAssembly);

    [Obsolete("Use GetRepository instead of GetLoggerRepository")]
    public static ILoggerRepository GetLoggerRepository();

    [Obsolete("Use GetRepository instead of GetLoggerRepository")]
    public static ILoggerRepository GetLoggerRepository(string repository);

    [Obsolete("Use GetRepository instead of GetLoggerRepository")]
    public static ILoggerRepository GetLoggerRepository(Assembly repositoryAssembly);

    public static ILoggerRepository GetRepository();
    public static ILoggerRepository GetRepository(string repository);
    public static ILoggerRepository GetRepository(Assembly repositoryAssembly);

    [Obsolete("Use CreateRepository instead of CreateDomain")]
    public static ILoggerRepository CreateDomain(Type repositoryType);

    public static ILoggerRepository CreateRepository(Type repositoryType);

    [Obsolete("Use CreateRepository instead of CreateDomain")]
    public static ILoggerRepository CreateDomain(string repository);

    public static ILoggerRepository CreateRepository(string repository);

    [Obsolete("Use CreateRepository instead of CreateDomain")]
    public static ILoggerRepository CreateDomain(string repository, Type repositoryType);

    public static ILoggerRepository CreateRepository(string repository, Type repositoryType);

    [Obsolete("Use CreateRepository instead of CreateDomain")]
    public static ILoggerRepository CreateDomain(Assembly repositoryAssembly, Type repositoryType);

    public static ILoggerRepository CreateRepository(Assembly repositoryAssembly, Type repositoryType);
    public static ILoggerRepository[] GetAllRepositories();
    }

    The implementation of LogManager is conspicuously absent…a very disappointing result. I SINCERELY hope that this new feature of ReSharper 6 does not stop at only providing the above class “interface”, and when finally release will actually DECOMPILE the full implementation. If the above is all we get without a .PDB file, then I find it a little shameful that you are hyping this new ReSharper 6 feature as an alternative to Reflector. While I truly, TRULY loath giving RedGate any money for a tool that has been free for the better part of a decade, and which they promised to keep free, ReSharper 6 is not actually an alternative to it if .PDB files are required for full implementation “decompilation”.

    Don’t piss off your own community the same way RedGate pissed off the entire .NET community…be HONEST about your intentions, and don’t make people waste a lot of money getting a tool that won’t actually service their needs. Don’t debase the meaning of decompilation, as what you are currently providing is in no way, shape, or form actual “decompilation” of code…it is either simply the presentation of metadata (which is already available in other forms, such as via Object Browser), or the extraction of existing information from a .PDB (which is convenient, but not really solving the problem space that Reflector currently solves.)

  32. @Jon Rista

    Is this “decompilative” enough?
    http://www.youtube.com/watch?v=AgfWBoBtBKI
    Decompiled using ReSharper 6 EAP build 2102 (released on March 1)

  33. Jon Rista says:

    That looks good! I can’t tell from the video if you had a .PDB or not. Was that code actually decompiled from an assembly without PDB info? If so, SUPERB, and I will truly be looking forward to ReSharper 6!

  34. Jon Rista says:

    I am actually a bit confused. I have installed ReSharper 6.0.2102.59, as indicated below. I’ve tried to decompile numerous third-party libraries, but all I get is the interface. Implementations are not generated when I use the “Decompiled Sources” option. Am I running into a bug?

    Version Info:
    JetBrains ReSharper 6.0 EAP Full Edition Pre-Release
    Build 6.0.2102.59 on 2011-03-01T02:10:38

    Free evaluation not started
    Plugins: none.
    Visual Studio 9.0.30729.1.

    Copyright © 2003–2011 JetBrains s.r.o.. All rights reserved.

  35. Jon Rista says:

    Turns out it was the way I was accessing the feature. Decompilation DOES work (woot!!), but you have to use the Alt-` hotkey to use the ReSharper 6 “Navigate” menu’s “Decompile Sources” command for it to fully decompile the implementation. Simply right-clicking a type, using the “Navigate To” sub menu, and clicking “Decompile Sources” only generates the interface. (Seems like a bug to me…perhaps the discrepancy is by design…)

    THANK YOU, JetBrains! Can’t THANK YOU enough for providing a high quality alternative to Reflector! RedGate can eat their betrayal and reap the justified wrath of a now-still-satisfied .NET community. ;)

  36. @Jon Rista,

    This genuinely looks like a bug, and a weird one. I have reported it as http://youtrack.jetbrains.net/issue/RSRP-222891

    Thanks for discovering this strange behavior, we’ll definitely fix it for v6 release.

  37. Dima says:

    R#6 is freezes Visual Studio 2010 VERY often.. Hope you understand that we dont need that javascript support if IDE will freeze..It just slows me down, so that the main slogan of this PRODUCTIVITY plugin is becoming just strange. Hope you will work on performance before even first beta release.
    Still thank you for a great tool.

  38. @Dima
    We’re definitely working on performance, and the closer a release the more we do that.
    Please let me know if you’re willing to profile VS with ReSharper to find out the source of the freeze problem.

  39. 3J says:

    So…

    (Red-Gate .NET Bundle)
    + (CodeRush)
    - (Step into decompiled code during debug)
    - (Code Templates capability)
    + Source Highlighting
    ——————————————————
    Resharper 6

  40. @3J
    Can you clarify please?

  41. Florian Standahrtinger says:

    great news for sure!
    does free mean you will allow third party developers to build plugins for your decompiler or maybe even allow redistribution of the decompiler-dll and using it as a library?

  42. @Florian

    We’re thinking of extensibility via enabling third-party plug-ins. That will hardly be available in time for the initial release though.
    As to redistribution as dll, we’re not planning that.

  43. asdfasfd says:

    Thank you! I’ve ditched Red Gate for absolutely ruining Reflector and can’t wait for a suitable change. Looking forward to the Resharper 6 upgrade!

  44. lacithetemplar says:

    I can’t see “Decompiled sources” in Resharper “Navigation to” menu. Where is the problem?

  45. @lacithetemplar
    Could be some temporary issues in a certain EAP build. Which build do you have installed?

  46. lacithetemplar says:

    Build 6.0.2116.37

  47. @lacithetemplar
    Thanks. Indeed, it’s been out of service in a few builds.
    I can see the decompiler working in build 6.0.2118.69 (current the latest build on the ReSharper 6 Nightly Builds page)

  48. lacithetemplar says:

    I’m trying the latest build, but with the same result. I cannot see this option in “Navigate to” menu. Hmmm…

  49. @lacithetemplar
    OK, go to ReSharper > Options > Tools > External sources.
    Make sure that the “Decompile method bodies” check box is selected.
    Does it work now?

  50. lacithetemplar says:

    I have checked thid option, but it doesn’t work.

  51. lacithetemplar says:

    Which version of Visual Studio did you test? I’m using Visual Studio 2010 Ultimate. Maybe there is the problem

  52. @lacithetemplar
    I’m using VS2010 Professional. Will investigate if that’s the problem but I guess rather it’s some unexpected change in the set of items in the “Navigate to” menu.
    Does it work if you navigate to a library symbol using “Go to declaration” or, say, “Go to type”?

  53. lacithetemplar says:

    I don’t know, when I use “Go to declaration” or “Go to type”, it starts to download symbol pdb file. But in one case, when I used “Go to declaration”, it show me warning that I’m going to use decompilation.

  54. @lacithetemplar
    That’s ok. ReSharper uses symbol files as a priority way of rendering unavailable sources.
    If you deselect “Use debug information for navigation” in ReSharper > Options > Tools > External sources, ReSharper should choose to decompile when there’s a choice between decompiling and downloading symbol files.
    However, we definitely need to take a second look at UI options in both “Navigate to” and Options. Thanks for your feedback!

  55. DanF says:

    Hi:
    We are evaluating the nightly builds for EAP 6. However, people who have VS 2010 (and CLR4) can run/install the nightly builds fine into VS2010. However, folks with VS2008 receive various errors when trying to launch. Will EAP 6 be available in VS 2008? Are these errors just a product of being nightly builds?
    Thanx

  56. @DanF
    ReSharper 6 should work smoothly both in VS2008 and VS2010.
    We’d love to know more details about the errors that your colleagues are facing.
    Our QA will contact you for additional info that we need to reproduce these errors.
    Thanks for reporting this!

  57. Eyal-Shilony says:

    I like JetBrains! this is simply amazing, it’s late here in israel and I just heard about it and I had to post a reply and say a big THANK YOU, you guys are amazing.

  58. AB says:

    Thanks a Kazillion !

  59. Mike says:

    So when are you going to kill it?

    Like you killed the free test runner, remember? Because I sure do remember! Just as I remember how Red-Gate told us that Reflector would be free.

    I am posting this here and bookmarking so that in 3 years I can say: “See, told you so!”

  60. @Mike
    Let me guess. When it’s not used by anyone anymore?

  61. tc says:

    As always JetBrains, you ROCK!
    I just love your products, keep it up guys :)

  62. Xcalibur says:

    dotPeek early builds are horrendously slow and clunky. I recently found the open source ILSpy tool and it is way superior feature and speed wise, including great OOB XAML support. Keep up the good work though, i really have high hopes for debugging externally libraries, etc right from with R#

  63. hein says:

    @Xcalibur

    Decompilation without being able to debug into the decompiled sources is not enough for my work. Sure I can see the code with the issue(s) but if I cannot debug then I cannot isolate *where* those issue(s) are. I really hope Jetbrains gets this feature into R#.

  64. Matt Mitchell says:

    I support the “debug into decompiled sources” requests everyone above is talking about.

  65. xxx says:

    Debug into external source would be very very useful.

  66. ShloEmi says:

    Hi,
    I’ve just created a short article about DotNet Reflector alternatives…
    Here are some: dotPeek, JustDecompile, CodeReflect, ILSpy.

    More can be found here: http://www.shloemi.com/2012/05/dotnet-reflector-decompiler-free-tools/

  67. Alex says:

    I want to decompile separate dll. Can I do this with resharper?

  68. @Alex. With ReSharper, you can’t do that. However, you can with dotPeek

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>