- What is dotPeek
- Assembly Explorer
- Viewing source code
- Navigation and Search
- Navigating to everything
- Navigating to a type
- Navigating to a specific symbol
- Navigating to string literals
- Navigating between file members
- Navigating to a code file or assembly
- Context-sensitive navigation
- Searching in decompiled Code
- Navigation to exception
- Navigating to action
- Type Hierarchy
- Type Dependency Diagram
- Reference Hierarchy
- Getting source code from source servers
- Keyboard-driven navigation between tool windows
- dotPeek Symbol Server
- Generating PDB files
- Process explorer
- Customizable, rich tool windows
- What's next?
dotPeek is a free .NET decompiler and assembly browser from JetBrains. JetBrains is also known as 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 for continuous integration and build management and YouTrack for issue tracking.
...make high-quality decompiling coupled with powerful ReSharper-like navigation and search features available to everyone in the .NET community, free of charge...
The main idea behind dotPeek is to make high-quality decompiling coupled with powerful ReSharper-like navigation and search features available to everyone in the .NET community, free of charge.
|For all features described below, there are keyboard shortcuts. By default, dotPeek uses the Visual Studio keymap derived from ReSharper. dotPeek also provides another keymap familiar to ReSharper users - IntelliJ IDEA. You can switch between those schemes under Tools | Options | Environment | General. In this tutorial, we use Visual Studio keymap shortcuts.|
dotPeek has gone public for the first time in May 2011 as JetBrains opened an Early Access Program (EAP) that implied regular publishing of pre-release builds. dotPeek 1.0 has been officially released on May 10, 2012. The latest official version of the decompiler and assembly browser is always available at http://www.jetbrains.com/decompiler
JetBrains is also providing decompiling functionality as part of ReSharper, the renowned productivity tool for Visual Studio.
dotPeek is available for download in two distributions: an .msi installer and portable versions for 32-bit and 64-bit processors.
- The installer-based distribution is a safe bet if you want to use dotPeek on a single PC and take advantage of automatic version management.
- The portable distribution is a better fit if you prefer to share dotPeek between multiple machines - for example, using a flash drive or Dropbox folder.
Both distributions are functionally equivalent except for the way you configure Windows Explorer integration.
...opening assemblies right from the Windows Explorer...
dotPeek allows opening assemblies right from the Windows Explorer by right-clicking on them and choosing Browse with JetBrains dotPeek. If you're deploying dotPeek using the installer, Windows Explorer integration is enabled automatically. However, if you're using the portable distribution, you need to choose Tools | Options | Environment | General, and select Integrate with Windows Explorer to enable Windows Explorer integration.
...dotPeek decompiles any .NET assemblies and presents them as C# code...
dotPeek decompiles any .NET assemblies and presents them as C# code. Supported file types include:
- Libraries (.dll)
- Executable files (.exe)
- Windows 8 metadata files (.winmd)
- Archives (.zip)
- NuGet packages (.nupkg)
- Microsoft Visual Studio Extensions packages (.vsix)
Files can be opened in one of the following ways:
...assemblies can be also loaded from running processes...
- Using the File | Open command.
- Via drag-and-drop of a file (or a selection of files) to the dotPeek window.
- For .dll and .exe files: By right-clicking a file in Windows Explorer and selecting Browse with JetBrains dotPeek.
- Assemblies can be also loaded from running .NET processes with the help of Process Explorer.
...you can also load entire folders...
You can also load entire folders into the Assembly Explorer by choosing File | Explore Folder. When you ask dotPeek to explore a folder, it processes all its subfolders in hunt for files that it is able to decompile, and displays the folder's hierarchy in the Assembly Explorer.
Assembly Explorer uses the same set of icons that are used in Visual Studio for identification of code symbols. To filter the content displayed in the Assembly Explorer, start typing the name of an assembly or a symbol.
|Since dotPeek processes selected folders recursively, make sure to act wisely. You wouldn't really want to explore the entire Program Files folder because it would take a really long time to load all assemblies that it contains.|
Assembly Explorer also displays nodes representing base types and inheritors of the current type. This is a way to browse type inheritance trees that developers with .NET Reflector background usually find appealing.
- Double-clicking a reference loads the referenced assembly, if immediately available.
- Double-clicking a type or type member displays decompiled code in the code viewer.
- Double-clicking an entry under the Resources folder opens the source representation of the corresponding resource in the code viewer, or passes it to an external application.
To apply order to the way you work with multiple assemblies, and also to support switching between different sets of assemblies, dotPeek provides assembly lists. You can work with different assembly lists depending on your context. You can save and reopen assembly lists, or clear the current list if you no longer need it. Assembly lists are not limited to .dll and .exe files: they can contain all supported file types (including archives) and folders.
Assemblies from Global Assembly Cache (GAC) can be opened via File | Open from GAC. While opening assemblies from GAC you can batch-select assembly items and filter out assemblies by entering first letters of their CamelHump names. For example, to find all assemblies with names containing Microsoft.VisualStudio.Modeling in the list of GAC assemblies, you can type mvsm. By the way, CamelHumps support is an important concept that also spans multiple navigation features of dotPeek.
...saves it as a complete Visual Sudio project...
dotPeek provides a command that automatically decompiles the selected library and saves it as a complete Visual Sudio project. Right-click on the assembly in the Assembly Explorer, and choose Export to Project. There is an option to open the decompiled project in Visual Studio right away:
...look-and-feel of editor tabs in Visual Studio...
Source code that dotPeek decompiles is presented as C#. The Code Viewer has the look-and-feel of editor tabs in Visual Studio, with configurable presentation options, such as line numbers, options for word wrap and outlining, white space marks, and tabs to open different types in.
...code syntax is highlighted ReSharper-style...
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:
...successively select expanding blocks of code...
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+Alt+Right) 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 code file. A pair shortcut (Ctrl+Alt+Left) works the opposite way, successively narrowing a selection. Read more about this functionality as it is implemented in ReSharper.
...display all available signatures...
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:
- View | Parameter Information (Ctrl+P) on a method call will display all available signatures of a given method.
...overview of its documentation comments...
- View | Show Quick Documentation (Ctrl+Shift+F1) on a usage of a type, method, property, or another type member will display an overview of its documentation comments:
...turn off certain compiler transformations...
Using the Show compiler-generated code switch on the dotPeek action bar, you can choose to turn off certain compiler transformations, thus making code structure that dotPeek displays very similar to what the compiler turns it to. This helps see how compiler deals with lambdas, closures, and auto-properties, among other things.
...majority of ReSharper navigation features are available in dotPeek...
The main thing that distinguishes dotPeek from other decompilers around is that the majority of ReSharper navigation features are available in dotPeek as well.
When you're loading an assembly and you don't know what you're looking for and you want to find out how things are organized within the assembly - you can start off with the Assembly Explorer and you will probably proceed by navigating between symbol declarations in the code view area.
However, you go a different path if you know exactly (or even approximately) which part of the assembly you need to look at - in this case, you can use one of ReSharper's "go to" features.
...navigate to all possible destinations (types, symbols or files)...
Use Navigate | Go to Everything/Type (Ctrl+T) to navigate to all possible destinations (types, symbols or files). The list of suggestions appears as soon as you invoke this command and initially includes your recent files and navigated items. As you type in the pop-up, the list is updated according to your input.
...navigates to a specific class or interface...
If you press (Ctrl+T) twice, the Go To Type command is invoked, which navigates to a specific class or interface. You type in the name of the type you want to find, and dotPeek searches for a match within all loaded assemblies.
In both Go to Everything and "Go to Type", the concept of CamelHumps is applicable - you don't need to type DatasetMethodGenerator to open this class - typing dmg is enough:
...navigate to a specific symbol declaration...
Use Navigate | Go to Symbol (Shift+Alt+T) to navigate to a specific symbol declaration, which could be a type, method, field, or property. Again, use CamelHumps to narrow down the list of symbols that dotPeek presents:
Since the number of symbols is greatly higher than that of types, and there can possibly be multiple symbols with the same name, you may want to spend a little more time investigating the list of results. One way to do that is press the plus sign (Show in Find Results) while dotPeek shows symbols in the Go to Symbol drop-down list - this will allow you to flush all found results to the Find Results window where you can take your time to investigate the results, group based on different criteria, copy to clipboard or export to a file.
If necessary, you can also jump to any string literal defined in methods within all current assemblies and all assemblies referenced from those assemblies. To do so, choose Navigate | Go to String in the menu and then start typing characters in the pop-up that appears. As you type, the lookup list narrows down, suggesting string declarations that match the entered substring.
Note, that case-insensitive CamelHumps is supported even here. For example, you can type dporange to find dockPosition is out of range.
...quick overview of and navigation to members in this file...
As soon as you've opened a specific type, use Navigate | Go to File Member (Alt+Backslash) for a quick overview of and navigation to members in this file.
Alternatively, you can open the File Structure window (Windows | File Structure, or Ctrl+Alt+F) for a static display of members in the current file.
File Structure provides additional file browsing capabilities: for example, if you set Automatically scroll to source in File Structure toolbar, every time you select a member in File Structure, the code viewer scrolls to the declaration of this member.
The Track caret in editor option works the opposite way: as you move the caret within the code viewer, the corresponding member is highlighted in File Structure.
dotPeek also provides Go to File (Navigate | Go to File or Ctrl+Shift+T) to quickly open files, folders, and assemblies. There are two use cases for this feature:
- You can navigate to a specific loaded assembly that gets highlighted in the Assembly Explorer.
- You can use it as an extended tab switcher that not only works with currently opened code files but also takes into account any tabs that you've opened during the current dotPeek session.
Speaking of previously opened files, if you've recently closed a code file but you need to have it open again, there's an easy way to have it back: just choose Navigate |Recent Files (Ctrl+,) and in the resulting drop-down list, pick the file you're looking for:
...navigate to symbol declarations, implementations, derived and base symbols, and any other applicable destinations...
dotPeek provides the same level of insight in context-sensitive navigation between decompiled code symbols as ReSharper does for source code. You navigate to symbol declarations, implementations, derived and base symbols, and any other applicable destinations just like you would in Visual Studio with ReSharper enabled.
Specifically, when you've landed the caret on a symbol, you can always get an overview of all possible navigation targets using the Navigate To drop-down menu (Navigate | Navigate To or Alt+`):
The majority of navigation destinations presented in the Navigate To drop-down menu are also available directly through the top-level Navigate menu.
The following context-sensitive navigation commands can be available depending on context:
- Go to Declaration (F12): this takes you from a usage of any symbol to its declaration. Should the symbol be dependent on another assembly, the assembly will be loaded silently, if available.
- Go to Base Symbols (Alt+Home): this takes you to corresponding symbols upwards the inheritance hierarchy:
- Go to Derived Symbols (Alt+End): the opposite of Go to Base Symbols, this command lets you go to any of implementing/overriding members or implementing/derived types:
- Go to Implementation (Ctrl+F12): allows navigating to end implementations of types and type members, bypassing intermediate inheritance steps in the inheritance chain, such as abstract classes.
- Go to Extension Methods (only available through Navigate To): shows all extension methods for a certain type.
- Go to Exposing APIs navigates from a type to all places where you can get an instance of this type: public fields and properties, method return values, out parameters, etc.
- Go to Sources from Symbol Files (only available through Navigate To): download symbol information from a source server and recreate source code. (See below for more information.)
- Locate in Assembly Explorer (only available through Navigate To): navigates from a type or type member in the Source Viewer to the corresponding node in the Assembly Explorer. Interestingly, this command is duplicated by another shortcut, Shift+Alt+L, that, when applied in ReSharper, locates the currently open file in the Solution Explorer.
dotPeek offers the same capabilities of searching for items in decompiled code as ReSharper offers in source code inside Visual Studio. Here's the list of features serving to find all references to a certain symbol:
...all usages of a symbol...
- Navigate | Find Usages (Shift+F12): This finds all usages of a symbol (method, property, local variable etc.) from its any occurrence, be it a declaration or one of its usages. You can invoke this command from the Code Viewer, from the Assembly Explorer, or any other tool window. If more than a single usage is found, all usages are fetched to the Find Results window where you can group them in different ways, navigate between them, and open in the code view area. You can learn more about Find Usages on ReSharper web site.
- Navigate | Usages of Symbol (Shift+Alt+F12): This is a modification on Find Usages that shows a pop-up with all found usages instead of flushing them to Find Results. This is handy when you have a limited set of usages from which you can quickly pick the one you need. It is also available via the Navigate To drop-down menu.
...fine-tune search criteria...
- Navigate | Find Usages Advanced (Ctrl+Shift+Alt+F12): This is a zoomed-in version of Find Usages that allows you to fine-tune search criteria by limiting the scope of search and other characteristics.
...navigate to where the exception originated...
When you receive an external stack trace with an exception (for example, from a bug report), you can navigate to where the exception originated. Just copy the exception stack trace to the clipboard and use Tools | Browse Stack Trace or press Ctrl+E,T. The Stack Trace Explorer that opens will represent lines within the stack trace as hyperlinks.
dotPeek helps you quickly find and apply any of its actions without digging through the menu. By an action, we mean an executable command available for the current caret position or a command that opens a tool window. TO find and apply an action, press Alt+Enter and start typing the name of the action or try any related words. For example, you can type property to find actions related to type members:
...get an overview of a certain inheritance chain...
We've already covered Go to Derived Symbols and Go to Base Symbols above but these two features are useful when you want to go to an inheritor or a base symbol right away. What if you're looking to plainly get an overview of a certain inheritance chain? That's where the Type Hierarchy view comes handy: press Ctrl+Alt+H on a usage of any type, and dotPeek will show you all types that are inherited from it, as well as types that it inherits itself - as a tree view, in a separate tool window.
Goodness doesn't end here, though: you can select nodes in the tool window, rebase hierarchies on them; show or hide previews of type members; and switch between several hierarchy views: for example, you can opt to only show subtypes or supertypes of a given type.
...visually study how types depend on each other in explored assemblies...
dotPeek allows you to visually study how types depend on each other in explored assemblies. In the type dependency diagram, you can add any number of types from different assemblies and visualize different kinds of dependencies between them. Besides the main menu command, Inspect | Show Type Dependency Diagram, there are plenty of ways to add types to the diagram: e.g. you can add all types from the Find Results or Hierarchy window, from navigation results pop-ups, and more.
For exploring further, a lot of navigation actions are available right from the type dependency diagram.
...track down all assembly dependencies...
A derivative of Type Hierarchy introduced above, the Reference Hierarchy window shows which references the current assembly has, allowing you to track down all assembly dependencies, and additionally showing recursive dependencies with a glyph to the right of a reference entry.
If you click Referencing projects in the tool window’s toolbar, you can see which of the assemblies in your current assembly list reference the current selected assembly.
...get symbol information and recreate source code...
Decompiled code is better than nothing (especially if it's decompiled with dotPeek) but sometimes you want to explore an assembly exactly the way it had been originally written, and be able to read comments its developers have made. Sometimes dotPeek can help with that: it is able to get symbol information and recreate source code from Microsoft Reference Source Center and SymbolSource.org. You can try calling Navigate | Navigate To | Sources from Symbol Files on a type or member and see if symbol information for this particular assembly is available. You can even go as far as make downloading symbol files the default action for Go to declaration - to do so, go to Tools | Options | Decompiler and select Allow downloading from remote locations.
In the best traditions of JetBrains tools, you rarely need to use a mouse when working with dotPeek: switching between the Assembly Explorer and the Source Viewer; opening File Structure, Find Results, Type Hierarchy and other tool windows doesn't require mouse clicks: every tool window is assigned a shortcut of its own (see the Windows menu for shortcut hints), and getting back to the code view area is as easy as pressing Esc.
...generates PDB and source files for the requested assemblies and returns them back to the debugger...
dotPeek can function as a symbol server, that is, it can supply a debugger with the information required to debug compiled assemblies. In contrast to traditional symbol servers, e.g. Microsoft Symbol Server, dotPeek does not store any symbol files, it generates PDB and source files for the requested assemblies and returns them back to the debugger.
It is quite easy to use dotPeek symbol server locally to debug compiled assemblies with Visual Studio. To do so:
- Start dotPeek symbol server by clicking the corresponding button on the action bar.
- In the Visual Studio menu, select Tools | Options | Debugging | Symbols
- Click Add new location and specify the following address for it: http://localhost:33417/. (The port number is configurable on the Symbol Server page of dotPeek options).
- In the Visual Studio options, go to the Debugging | General page and clear the Enable Just My Code check box.
...generate a PDB file (together with the source files) for any .NET assembly...
If you need symbol files elsewhere than in the debugger, dotPeek provides a command to simply generate a PDB file (together with the source files) for any .NET assembly.
To generate PDB file for an assembly, select in tin the Assembly Explorer and click Generate PDB on the toolbar. In the PDB Generation dialog box that opens, specify the destination folder and click Generate.
...provides you with the list of currently running processes...
The Process Explorer window provides you with the list of currently running processes and allows exploring their modules and decompiling those of them that are .NET assemblies. Once you locate a process to decompile, you can add it to Assembly Explorer for further investigation by clicking the “+” button. From there, you can export the assembly to a Visual Studio project if necessary.
When it comes to customizing your workspace within dotPeek, you do need the mouse but otherwise, it's plain easy and familiar. Tool windows behave the same way they do in Visual Studio: they can be left floating or docked in multiple positions. Find Results and Type Hierarchy support multiple tabs, allowing you to have several sets of search results or hierarchies open at the same time. If you start typing in most of tool windows, the content is filtered to only display results that match the search string:
Thanks for reading up until this point! We hope you've had much fun playing with dotPeek.
In case you were just looking around trying to find out if the tool was worth it, now it's probably the right time to download the latest and greatest dotPeek and see with your own eyes.