dotPeek: free .NET decompiler from JetBrains, the makers of ReSharper, dotTrace, and dotCover for .NET developers, as well as a family of IDEs for Java, Ruby, Python, PHP, and other languages, plus team development tools: TeamCity and YouTrack.
dotPeek goes public for the first time on Tuesday, May 10, as JetBrains open an Early Access Program that implies regular publishing of pre-release builds.
JetBrains are also about to include decompiling functionality into their forthcoming release of ReSharper 6. In fact, decompiling has been announced as part of ReSharper 6 back in February 2011, and available in ReSharper 6 pre-release nightly builds since then.
dotPeek decompiles any .NET assemblies and presents them as C# code. Both libraries (.dll) and applications (.exe) can be opened with File > Open assembly.
In addition, assemblies from GlobaL Assembly Cache can be opened via File > Open from GAC. One thing to note about the Open from GAC dialog is that you can batch-select assembly items there, and you can also filter out assemblies by entering their CamelHumps - the capitals that different parts of assembly names start with. for example, to find all assemblies with names containing Microsoft.VisualStudio.Modeling in the list of GAC assemblies, you can type mvsm:
CamelHumps support is a significant concept that also spans multiple navigation feautres of dotPeek that are highlighted below.
dotPeek provides an assembly explorer to traverse the list of opened assemblies. Expanding an assembly node lists namespaces within the assembly that can be further expanded to types and type members, as well as assembly references. Note that the assembly explorer uses the same set of icons that we're used to in Visual Studio for member identification.
Clicking a reference loads the referenced assembly, if immediately available. Clicking a type or type member displays decompiled code in the source code view area.
Source code that dotPeek decompiles is presented as C#. The source code view area has the look-and-feel of editor tabs in Visual Studio, with line numbers, options for word wrap and outlining, white space marks, and tabs to open different types in.
Code syntax is highlighted ReSharper-style, with distinctive colors for properties, types, accessors, and methods.
When you put the caret on a delimiter, be it a brace or, say, parenthesis, it gets highlighted along with its counterpart, bringing focus to the scope of the particular code block you're in:
Similar to ReSharper, you can choose to highlight matching delimiters with a color or an outline. This and other code view area options can be set via File > Options.
Another noticeable ReSharper-like feature gets handy when you want to select a part of decompiled code, and is called Extend/Shrink Selection. Using a dedicated shortcut (by default, Ctrl+W) lets you successively select expanding blocks of code, starting from a substring of a symbol, on to a statement, line, code block, and all the way to the entire file. A pair shortcut (Ctrl+Shift+W) works the opposite way, successively narrowing a selection. Read more about this functionality as it is implemented in ReSharper.
When you explore decompiled code, you may be willing to learn more about referenced types and method calls without opening their declarations. Two coding assistance features from ReSharper will help you with that: Parameter Info (Edit > Parameter Information) on a method call will display all available signatures of the given method, and Quick Documentation (Edit > Show Quick Documentation) on a usage of a type, method, property, or another type member will display an overview of its documentation comments:
The primary idea behind dotPeek is to bring ReSharper experience to browsing external assemblies and make this available to everyone. The main thing that distinguishes dotPeek from other decompilers around is that the majority of ReSharper navigation features are available in dotPeek as well. Let's take a closer look at those:
Open assembly. If you don't know what you're looking for and you want to find out how things are organized within an assembly, use assembly explorer. If you know exactly or even approximately which part of the assembly you need to look at, use one of ReSharper's "go to" context-insensitive navigation features: