In this blog post I'd like to present a new feature of ILSpy decompiler: the integrated debugger. You can download it from
Please note that the ILSpy base functionality is similar to the soon-to-be-released M2 build. However, only use it if you want to test the debugger - if you are only interested in decompilation continue using the standard builds. The update check in this preview does not work, please disregard the request to update.
The debugger engine - Debugger.Core.dll - is basically the same as the one in SharpDevelop IDE - some modifications were made in order to use the latest version of NRefactory. The library that handles the UI stuff (like breakpoints, tooltips, attach to process window) - ILSpy.Debugger.dll - is based on SharpDevelop Debugger.Addin library.
When opening ILSpy, a new menu item is available: Debugger. Under this menu, you will find the following menu-items:
- Debug an executable - you will be asked to point to an .NET executable that ILSpy will start debugging
- Attach to a running application - you will be asked to point to a running .NET executable that ILSpy will debug
- Continue debugging (F5) - will continue the execution of the process
- Step into (F11) - will step into the code
- Step over (F10) - will step over the code
- Steo out (F11) - will step out the code
- Detach from running application - will detach the debugger
- Remove all breakpoints - will remove all breakpoints
Also, when decompiling a whole type, a margin appears on the left side of editor where breakpoints can be set (just like in SharpDevelop IDE). Setting breakpoints and debugging a single method/property will be implemented in future versions of this feature.
To debug a .NET application, one can use two different options:
- Debug an executable
- Attach to running application
The main difference of these two (from debugging experience point of view) is that when attaching to a running application that was optimized, the evaluation will not work. Therefore, we recomand to use the Debug an executable option. Using the last option, the evaluation will work for any kind of application.
When debugger is attached and a breakpoint is hit, the same common operations are available: continue, step into, step over, step over and evaluate something. Also, the status is shown in the status bar: Stand by, Running and Debugging.
Beside debugging in C# code, debugging in IL is also supported and breakpoints/current line mark are synchronized.
What is great about the debugger (beside it's existence in ILSpy :) ) is the fact that no PDB files are generated. The IL-C# code-mappings are determined on-demand and used to update the user interface.
- set breakpoints in single methods/properties - this is top priority
- mixed code (C# - IL) debugging - idea of David
- drag and drop current line marker
- others - community wishes :)
- debugging ASP.NET applications and web services is not working (yet)
If you find any issues on this feature, please let us now in our forum
or in our github issues
Have fun debugging the decompiled code! :)