OMG! This is a great tool. How could I live without knowing it.

If you are wondering what tool that provoked a reaction like this I will tell you that it is dnSpy. A .NET assembly editor, decompiler, and debugger and they advertise it on the GitHub page. And they do deliver those.

dnSpy is a tool for inspecting .NET assemblies. But it’s not only that. It a multi purpose tool that has everything you need. Ever. I think if you start using it you will never go back to any other tool. At least I know I won’t.

Let’s see what’s included in the “box”.

diassembler ✓

With IL spy you can disassemble you .NET applications and libraries.
dnspy-general-viewAs in almost all the tools – you can switch the view to show IL, C# or VB (anyone using VB?). The syntax coloring is readable (haven’t found if it can be changed) and you can switch themes if you don’t like the default dark one.

The disassembly process also works flawlessly (for now – I need to get my hands dirty a bit more :]).

If you haven’t read my latest post about how to trick IL disassemblers with .emitbyte go check it here. dnSpy can’t be fooled with such easy trick. It handles invalid byte correctly and displaying an UNKNOWN there.

If you are overwhelmed with the info that is displayed you can control it in the options. And it can too much sometimes as you can even show textual description of opcodes – nice!

debugger ✓

Yup. That’s in the package too. With dnSpy you can debug your assemblies right from the tool. Also you can select where it should break.

breakat

With that option, when needed, you can break not only in the Entry point. The list is quite long so it will support some strange debugging cases if needed.

*Editor ✓

dnSpy is also an editor. ÜberEditor. You can edit an assembly but you can do it in more than one way.

You can just edit plain-old C#. Just type the code and it will be compiled in into your assembly. Nice feature but nothing super-geeky yet 😉

If you are a freak (like me) and mental (probably me) – you can switch to IL and go nuts there.

ileditor

The third mode is even more geeky than the previous one. Go crazy in pure hex-editor. This options allows you to edit the full exe/dll.

hexeditor-matrix

Additionally you can add stuff in. Edit menu supports creating new things like types, methods and so on. Pure sweetness.

editmenu

Oh yes. And you can delete stuff too 🙂

Other ✓

The tool looks so packed with features that I am probably missing something important in this (short) description. I’m still shocked how could I not used it before.

There’s a C# interactive console that allows quick & dirty code validation if needed. You can extend the tool tool and use the scripts. And a console version also is available if you need to produce some IL output without the need of GUI.

What I also like is that the tool is super fast. Starting is almost instant. I was very surprised when I first started the tool. I think it started almost

I believe this will be my tool of choice for a long time from now. Go check it now and search no more. This tool has everything you need. As for myself – I’m going to do some more playing with the tool.

*to work with IL of course

Founder of Octal Solutions a .NET software house.
Passionate dev, blogger, occasionally speaker, one of the leaders of Wroc.NET user group. Microsoft MVP