Understanding Libraries
Documentation tells you what a library does. Decompilation tells you how it does it. When you need to understand retry behavior, thread safety, serialization edge cases, or error handling that the docs do not cover, reading the implementation is the definitive answer.
Extracting from NuGet
Section titled “Extracting from NuGet”Most .NET libraries are distributed as NuGet packages. The dump_package tool extracts assemblies from a NuGet package directory into a flat folder for analysis:
-
Locate the package cache
NuGet packages are cached locally. The default locations are:
- Windows:
%USERPROFILE%\.nuget\packages\ - Linux/macOS:
~/.nuget/packages/
Each package has versioned subdirectories containing the compiled assemblies.
- Windows:
-
Extract the assemblies
Point
dump_packageat the package directory:"Dump the package at ~/.nuget/packages/newtonsoft.json/13.0.3/ to ./newtonsoft-extracted"This copies all
.dlland.exefiles from the package structure into a single directory. -
Analyze the extracted assembly
Now use the standard tools against the extracted DLL:
"Get metadata summary of ./newtonsoft-extracted/Newtonsoft.Json.dll"
Finding Entry Points
Section titled “Finding Entry Points”When you want to understand how a library handles a specific operation, start by searching for the method you call from your own code:
"Search for methods named 'DeserializeObject' in Newtonsoft.Json.dll"This shows you the declaring type and all overloads. Then decompile the type to read the full implementation:
"Decompile the JsonConvert class from Newtonsoft.Json.dll"Tracing Internal Behavior
Section titled “Tracing Internal Behavior”Library methods often delegate to internal classes that do the real work. Once you have decompiled the public entry point, follow the chain:
"Search for types containing 'JsonSerializer' in Newtonsoft.Json.dll""Decompile the JsonSerializerInternalReader class"The search_methods tool with type_filter helps narrow down large internal classes:
"Search for methods containing 'Populate' in Newtonsoft.Json.dll, filtered to type JsonSerializerInternalReader"Understanding Configuration and Defaults
Section titled “Understanding Configuration and Defaults”Libraries often have settings objects with defaults that are not fully documented. Use search_fields with constants_only to find them:
"Search for constant fields in Newtonsoft.Json.dll with pattern 'Default'"And search_properties to find configuration surfaces:
"Search for properties containing 'Setting' or 'Option' in Newtonsoft.Json.dll"Comparing Versions
Section titled “Comparing Versions”If you are debugging a version-specific issue, extract both versions and decompile the same type from each. The language_version parameter does not affect the comparison — use Latest for both and diff the output.
"Decompile HttpClient from System.Net.Http.dll version 4.x""Decompile HttpClient from System.Net.Http.dll version 8.x"Side-by-side comparison of the decompiled source reveals behavioral changes between versions that changelogs may not mention.