Ilspy Decompile
Testing & Qualityilspy-decompileIlspy Decompile is an Agent Skill for testing & quality published in the Ourpalm/ILRuntime repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Decompile .NET assemblies using ilspycmd CLI tool. Invoke when you need to inspect compiled DLLs, compare original vs patched assemblies, or examine compiler-generated types (closures, iterators, state machines).
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/Ourpalm/ILRuntime/blob/HEAD/.trae/skills/ilspy-decompile/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/ilspy-decompile, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
ILSpy Command-Line Decompilation
Decompile .NET assemblies using ilspycmd to inspect compiled code structure, compare builds, and debug HybridPatch issues.
Prerequisites
ilspycmd is installed as a global .NET tool:
dotnet tool install --global ilspycmd
Common Commands
List all types in an assembly
ilspycmd -l MyLibrary.dll
Use this first to discover type names, especially compiler-generated ones.
Decompile a specific type
ilspycmd -t "Namespace.ClassName" MyLibrary.dll
For nested types, use / as separator: ilspycmd -t "Outer/Inner" MyLibrary.dll
Decompile entire assembly to stdout
ilspycmd MyLibrary.dll
Decompile to a project folder
ilspycmd MyLibrary.dll -p -o ./OutputDir
Decompile to a single file
ilspycmd MyLibrary.dll > Output.cs
Key Options
| Option | Description |
|---|---|
-o, --output <dir> | Set output directory or file path |
-p, --project | Export as C# Visual Studio project |
-t, --type <name> | Decompile only the specified type |
-l | List types without full decompilation |
--no-dead-code | Remove redundant compiler-generated blocks |
Typical Workflow for HybridPatch Debugging
-
List types in both original and patched DLLs to spot naming differences:
ilspycmd -l HotfixAOT/bin/Release/net8.0/HotfixAOT.dll ilspycmd -l HotfixAOT/bin/Release_Patched/net8.0/HotfixAOT.dll -
Compare compiler-generated types (closures
<>c__DisplayClass*, state machines<Method>d__*):ilspycmd -t "HotfixAOT.SomeClass/<>c__DisplayClass0_0" original.dll ilspycmd -t "HotfixAOT.SomeClass/<>c__DisplayClass0_0" patched.dll -
Inspect injected DLL to verify injection results:
ilspycmd -t "HotfixAOT.SomeClass" HotfixAOT/Patched/HotfixAOT.dll -
Check hash file for type name mappings after
FixClosureNameConsistency:- The
.hashfile records type hashes used for closure renaming - Compare type names in hash vs actual DLL to find mismatches
- The
Key Paths in This Project
- Original (Release) DLL:
HotfixAOT/bin/Release/net8.0/HotfixAOT.dll - Patched (Release_Patched) DLL:
HotfixAOT/bin/Release_Patched/net8.0/HotfixAOT.dll - Injected + Patched DLL:
HotfixAOT/Patched/HotfixAOT.dll - Hash file:
HotfixAOT/Patched/HotfixAOT.hash - Patch file:
HotfixAOT/Patched/HotfixAOT.patch