Top Related Projects
.NET deobfuscator and unpacker.
.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
Blazing fast and correct x86/x64 disassembler, assembler, decoder, encoder for Rust, .NET, Java, Python, Lua
A library for patching, replacing and decorating .NET and Mono methods during runtime
Cheat Engine. A development environment focused on modding
Ghidra is a software reverse engineering (SRE) framework
Quick Overview
dnSpy is a powerful debugger and .NET assembly editor for Windows. It allows users to decompile, debug, and modify .NET applications and assemblies, even without source code. dnSpy provides a user-friendly interface for reverse engineering and analyzing .NET programs.
Pros
- Advanced debugging capabilities for .NET applications
- Powerful decompilation and code analysis features
- Ability to edit and recompile assemblies on-the-fly
- User-friendly interface with syntax highlighting and navigation tools
Cons
- Limited to Windows operating systems
- May be used for malicious purposes if not handled responsibly
- Learning curve for advanced features can be steep for beginners
- Not actively maintained since 2020, which may lead to compatibility issues with newer .NET versions
Getting Started
- Download the latest release from the dnSpy GitHub releases page.
- Extract the downloaded ZIP file to a folder of your choice.
- Run
dnSpy.exe
to launch the application. - To open an assembly, go to File > Open and select the desired .NET assembly file.
- Use the tree view on the left to navigate through namespaces, types, and members.
- Double-click on a method to view its decompiled code.
- To start debugging, go to Debug > Start Debugging and select the appropriate options for your target application.
Note: dnSpy is not a code library, so there are no code examples or quick start instructions for integration into other projects. It is a standalone application for debugging and analyzing .NET assemblies.
Competitor Comparisons
.NET deobfuscator and unpacker.
Pros of de4dot
- Specialized in deobfuscation and cleaning of .NET assemblies
- Supports a wide range of obfuscators and protectors
- Command-line interface allows for easy integration into automated workflows
Cons of de4dot
- Limited functionality beyond deobfuscation
- Less user-friendly for those unfamiliar with command-line tools
- Not actively maintained (last commit in 2018)
Code Comparison
de4dot (command-line usage):
de4dot.exe -r file1.dll file2.exe
dnSpy (C# code for loading an assembly):
var asm = AssemblyDef.Load("file.dll");
var module = asm.Modules[0];
Additional Notes
dnSpy is a debugger and .NET assembly editor with a graphical user interface, offering a broader range of features including debugging, decompiling, and editing of .NET assemblies. It provides a more comprehensive toolkit for .NET reverse engineering and analysis.
de4dot, on the other hand, focuses specifically on deobfuscation and cleaning of .NET assemblies. It's particularly useful for removing protection and obfuscation from assemblies, making them easier to analyze or reverse engineer.
While both tools are valuable for .NET reverse engineering, they serve different primary purposes and can be complementary in a reverse engineer's toolkit.
.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
Pros of ILSpy
- More actively maintained with frequent updates
- Better support for newer .NET versions and language features
- Larger community and more contributors
Cons of ILSpy
- Lacks advanced debugging features
- User interface is less intuitive for some users
- Slower performance when decompiling large assemblies
Code Comparison
ILSpy:
public class DecompilerSettings
{
public bool AnonymousMethods { get; set; }
public bool YieldReturn { get; set; }
public bool AsyncAwait { get; set; }
}
dnSpy:
public sealed class DecompilerSettings : INotifyPropertyChanged
{
public bool DecompileAsynchronousMethodsAsynchronously { get; set; }
public bool AnonymousMethods { get; set; }
public bool YieldReturn { get; set; }
}
Both ILSpy and dnSpy are powerful .NET decompilers, but they have different strengths. ILSpy is more frequently updated and has better support for newer .NET features, while dnSpy offers advanced debugging capabilities. The code comparison shows similarities in their decompiler settings, with dnSpy implementing INotifyPropertyChanged for better UI integration. Ultimately, the choice between the two depends on specific user needs and preferences.
Blazing fast and correct x86/x64 disassembler, assembler, decoder, encoder for Rust, .NET, Java, Python, Lua
Pros of iced
- Focuses specifically on x86/x64 instruction decoding and encoding
- Supports multiple programming languages (Rust, C, C#, Python)
- Actively maintained with frequent updates
Cons of iced
- More limited in scope compared to dnSpy's full-featured debugger
- Steeper learning curve for non-assembly programmers
- Less comprehensive documentation for beginners
Code Comparison
iced (Rust):
use iced_x86::{Decoder, DecoderOptions, Instruction};
let bytes = b"\x48\x89\x5C\x24\x10\x48\x89\x74\x24\x18\x55\x57\x41\x56\x48\x8D\x6C\x24\xC0";
let mut decoder = Decoder::with_ip(64, bytes, 0x1234_5678, DecoderOptions::NONE);
let mut instruction = Instruction::default();
while decoder.can_decode() {
decoder.decode_out(&mut instruction);
println!("{:016X} {}", instruction.ip(), instruction);
}
dnSpy (C#):
using dnSpy.Contracts.Debugger;
using dnSpy.Contracts.Debugger.DotNet.Evaluation;
public void StartDebugging(DbgProcess process) {
var runtime = process.Runtime as DbgDotNetRuntime;
if (runtime != null) {
var evaluator = runtime.GetEvaluator();
// Additional debugging logic here
}
}
Summary
iced is a specialized tool for x86/x64 instruction handling, while dnSpy is a more comprehensive .NET debugger and decompiler. iced offers multi-language support and active development, but has a narrower focus. dnSpy provides a full-featured debugging experience but is less frequently updated. Choose based on your specific needs: assembly-level work (iced) or .NET debugging and decompilation (dnSpy).
A library for patching, replacing and decorating .NET and Mono methods during runtime
Pros of Harmony
- Focused on runtime patching and modding, allowing for dynamic code modifications
- Easier to use for non-developers, with a simpler API for common patching scenarios
- Better suited for game modding and plugin development
Cons of Harmony
- Limited debugging capabilities compared to dnSpy's full-featured debugger
- Lacks decompilation and assembly editing features
- Not as versatile for general .NET reverse engineering tasks
Code Comparison
Harmony patch example:
[HarmonyPatch(typeof(TargetClass), "TargetMethod")]
class Patch
{
static void Postfix(ref int __result)
{
__result *= 2;
}
}
dnSpy debugging example:
// Set breakpoint and inspect variables
public void TargetMethod()
{
int result = CalculateValue();
Console.WriteLine(result);
}
Summary
Harmony is specialized for runtime patching and modding, making it easier for non-developers to modify .NET applications, especially games. dnSpy, on the other hand, is a more comprehensive tool for .NET reverse engineering, offering powerful debugging, decompilation, and assembly editing features. While Harmony excels in specific modding scenarios, dnSpy provides a broader set of capabilities for analyzing and modifying .NET assemblies.
Cheat Engine. A development environment focused on modding
Pros of Cheat Engine
- More versatile tool for game hacking and memory manipulation
- Supports a wider range of applications beyond .NET
- Includes advanced features like speedhacks and memory scanning
Cons of Cheat Engine
- Steeper learning curve for beginners
- Less focused on .NET-specific debugging and analysis
- May trigger antivirus software due to its nature
Code Comparison
While a direct code comparison is not entirely relevant due to the different focus of these tools, here's a brief example of how they might be used:
dnSpy:
// Decompiled C# code in dnSpy
public class Player
{
public int Health { get; set; }
}
Cheat Engine:
-- Cheat Engine Lua script
local health = readInteger(0x12345678)
writeInteger(0x12345678, 100)
dnSpy is primarily used for .NET assembly inspection and debugging, while Cheat Engine is more focused on memory manipulation and game hacking across various platforms. dnSpy provides a clean interface for .NET reverse engineering, whereas Cheat Engine offers a broader set of tools for memory scanning and modification in games and applications.
Ghidra is a software reverse engineering (SRE) framework
Pros of Ghidra
- Multi-platform support (Windows, macOS, Linux)
- More comprehensive reverse engineering capabilities, including support for a wider range of architectures
- Advanced features like decompilation and scripting support
Cons of Ghidra
- Steeper learning curve due to its complexity
- Slower performance compared to dnSpy, especially for large binaries
- Larger installation size and resource requirements
Code Comparison
dnSpy (C# decompilation):
public static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
Ghidra (C decompilation):
void main(void)
{
puts("Hello, World!");
return;
}
Summary
dnSpy is a lightweight .NET debugger and assembly editor, primarily focused on .NET applications. It offers a user-friendly interface and excellent performance for .NET-specific tasks.
Ghidra, developed by the NSA, is a comprehensive reverse engineering tool supporting multiple architectures and file formats. It provides advanced features like decompilation and scripting but requires more resources and has a steeper learning curve.
Choose dnSpy for .NET-specific tasks and quick analysis, while Ghidra is better suited for complex reverse engineering projects across various platforms and architectures.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
dnSpy - Latest release
dnSpy is a debugger and .NET assembly editor. You can use it to edit and debug assemblies even if you don't have any source code available. Main features:
- Debug .NET and Unity assemblies
- Edit .NET and Unity assemblies
- Light and dark themes
See below for more features
Binaries
https://github.com/dnSpy/dnSpy/releases
Building
git clone --recursive https://github.com/dnSpy/dnSpy.git
cd dnSpy
# or dotnet build
./build.ps1 -NoMsbuild
To debug Unity games, you need this repo too: https://github.com/dnSpy/dnSpy-Unity-mono (or get the binaries from https://github.com/dnSpy/dnSpy/releases/unity)
Debugger
- Debug .NET Framework, .NET and Unity game assemblies, no source code required
- Set breakpoints and step into any assembly
- Locals, watch, autos windows
- Variables windows support saving variables (eg. decrypted byte arrays) to disk or view them in the hex editor (memory window)
- Object IDs
- Multiple processes can be debugged at the same time
- Break on module load
- Tracepoints and conditional breakpoints
- Export/import breakpoints and tracepoints
- Call stack, threads, modules, processes windows
- Break on thrown exceptions (1st chance)
- Variables windows support evaluating C# / Visual Basic expressions
- Dynamic modules can be debugged (but not dynamic methods due to CLR limitations)
- Output window logs various debugging events, and it shows timestamps by default :)
- Assemblies that decrypt themselves at runtime can be debugged, dnSpy will use the in-memory image. You can also force dnSpy to always use in-memory images instead of disk files.
- Public API, you can write an extension or use the C# Interactive window to control the debugger
Assembly Editor
- All metadata can be edited
- Edit methods and classes in C# or Visual Basic with IntelliSense, no source code required
- Add new methods, classes or members in C# or Visual Basic
- IL editor for low-level IL method body editing
- Low-level metadata tables can be edited. This uses the hex editor internally.
Hex Editor
- Click on an address in the decompiled code to go to its IL code in the hex editor
- The reverse of the above, press F12 in an IL body in the hex editor to go to the decompiled code or other high-level representation of the bits. It's great to find out which statement a patch modified.
- Highlights .NET metadata structures and PE structures
- Tooltips show more info about the selected .NET metadata / PE field
- Go to position, file, RVA
- Go to .NET metadata token, method body, #Blob / #Strings / #US heap offset or #GUID heap index
- Follow references (Ctrl+F12)
Other
- BAML decompiler
- Blue, light and dark themes (and a dark high contrast theme)
- Bookmarks
- C# Interactive window can be used to script dnSpy
- Search assemblies for classes, methods, strings, etc
- Analyze class and method usage, find callers, etc
- Multiple tabs and tab groups
- References are highlighted, use Tab / Shift+Tab to move to the next reference
- Go to the entry point and module initializer commands
- Go to metadata token or metadata row commands
- Code tooltips (C# and Visual Basic)
- Export to project
List of other open source libraries used by dnSpy
- ILSpy decompiler engine (C# and Visual Basic decompilers)
- Roslyn (C# and Visual Basic compilers)
- dnlib (.NET metadata reader/writer which can also read obfuscated assemblies)
- VS MEF (Faster MEF equals faster startup)
- ClrMD (Access to lower level debugging info not provided by the CorDebug API)
- Iced (x86/x64 disassembler)
Translating dnSpy
Click here if you want to help with translating dnSpy to your native language.
Wiki
See the Wiki for build instructions and other documentation.
License
dnSpy is licensed under GPLv3.
Credits
Top Related Projects
.NET deobfuscator and unpacker.
.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
Blazing fast and correct x86/x64 disassembler, assembler, decoder, encoder for Rust, .NET, Java, Python, Lua
A library for patching, replacing and decorating .NET and Mono methods during runtime
Cheat Engine. A development environment focused on modding
Ghidra is a software reverse engineering (SRE) framework
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot