ilspycmd: add --member for single-member decompilation - #3924
Merged
Conversation
siegfriedpammer
force-pushed
the
ilspycmd-member-decompile
branch
from
July 27, 2026 20:12
f5a2f4a to
13ed5df
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new ilspycmd --member/-m option for decompiling a single member (by XML documentation id or metadata token), and introduces a dedicated ICSharpCode.ILSpyCmd.Tests project to host in-process CLI tests for current and future ilspycmd automation features.
Changes:
- Add
--member/-moption and member resolution logic to decompile exactly one entity from an input module. - Seed
ICSharpCode.ILSpyCmd.Testswith NUnit-based in-process tests drivingILSpyCmdProgram.Main. - Wire the new test project into the main solution, solution filters, and CI workflow execution.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ILSpy.XPlat.slnf | Adds the new ilspycmd test project to the cross-platform solution filter. |
| ILSpy.sln | Registers ICSharpCode.ILSpyCmd.Tests in the main solution and configurations. |
| ILSpy.Desktop.slnf | Adds the ilspycmd test project to the desktop solution filter. |
| ICSharpCode.ILSpyCmd/IlspyCmdProgram.cs | Implements --member option parsing and member resolution/decompilation flow. |
| ICSharpCode.ILSpyCmd/ICSharpCode.ILSpyCmd.csproj | Exposes internals to the new test project via InternalsVisibleTo. |
| ICSharpCode.ILSpyCmd.Tests/packages.lock.json | Introduces lock file for repeatable restores of the new test project. |
| ICSharpCode.ILSpyCmd.Tests/MemberOptionTests.cs | Adds in-process tests validating member decompilation and key error/usage paths. |
| ICSharpCode.ILSpyCmd.Tests/ICSharpCode.ILSpyCmd.Tests.csproj | New net11.0 test project configuration and references. |
| .github/workflows/build-ilspy.yml | Adds a CI step to execute the new ilspycmd tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Decompiling one method or property previously required decompiling its whole type and searching the output, which is wasteful for scripted and agent-driven use against large assemblies. The new -m|--member option accepts an XML documentation id string (the syntax of compiler-generated documentation files and of the UI's --navigateto option) or a metadata token in 0x06000005 form, resolves it against the main module (with a bounds check for tokens and distinct error messages for malformed ids, unknown members, and members of other modules), and prints just that member through the engine's single-member decompilation path. The tests seed a new ICSharpCode.ILSpyCmd.Tests project (part of the XPlat and Desktop solution filters and of the per-project CI test steps), driving the real Main in-process via InternalsVisibleTo, so future ilspycmd features have a dedicated home for CLI tests. Assisted-by: Claude:claude-fable-5:Claude Code
siegfriedpammer
force-pushed
the
ilspycmd-member-decompile
branch
from
July 28, 2026 11:26
13ed5df to
e714088
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements item 1 of the ilspycmd automation-workflow wishlist (christophwille/internal-ilspy-backlog#109).
-tis type-granularity; automated callers usually want exactly one member, and on large assemblies decompiling the whole type to answer a one-method question is the biggest source of wasted output. The new option:M:/P:/F:/E:/T:), identical to compiler-generated documentation files and the GUI's--navigateto, resolved viaIdStringProvider.FindEntity. Output is just the member, including its XML documentation when a documentation file is present.0x06000005), bounds-checked against the module's tables.EX_DATAERR) for malformed id strings, unknown members, out-of-range tokens, and members resolving into other modules;-tand-mare mutually exclusive (EX_USAGE).Tests (red-first): six in-process tests driving the real
MainviaInternalsVisibleTo, covering method/property doc-ids, the token form, both error paths, and the option conflict. They seed a dedicatedICSharpCode.ILSpyCmd.Testsproject (added toILSpy.slnviadotnet sln add, to both the XPlat and Desktop solution filters, and to the per-project CI test steps), giving future ilspycmd features -- the rest of the backlog wishlist implies several -- a proper home for CLI tests instead of piggybacking on the decompiler test project. Verified against System.Private.CoreLib; full decompiler suite green on Linux (2512 passed / 0 failed / 38 skipped).This PR was prepared by an AI agent (Claude) on behalf of @siegfriedpammer.
🤖 Generated with Claude Code