Skip to content

fix(managed): report ExportedType rows in managed member inspection - #1828

Merged
kaoru0822-kitauji merged 3 commits into
mainfrom
fix/managed-exported-types
Oct 11, 2026
Merged

kaoru0822-kitauji merged 3 commits into
mainfrom
fix/managed-exported-types

Conversation

@kaoru0822-kitauji

@kaoru0822-kitauji kaoru0822-kitauji commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #1812.

inspect-managed-members and MCP inspect_managed_members never read the ExportedType table (table 39). As a result, facade assemblies came back as coverage: complete with only <Module>, while inspect-managed-artifact reported hundreds of ExportedType rows for the same file. Examples are System.Runtime.dll (861 forwarders) and System.Web.Routing.dll (15).

Change

  • New exported_types array in the managed member inspection output. Each row is reported as declared:
    • token and row_offset
    • namespace and name
    • flags, with forwarder taken from IsTypeForwarder (0x00200000)
    • type_def_id (the hint column)
    • implementation_token, which points at the AssemblyRef, File, or enclosing ExportedType row
  • An out-of-range or null Implementation coded index keeps the row with implementation_token: null and marks coverage partial with an invalid-row issue. This matches how MemberRef parents and ManifestResource implementations are handled.
  • A new limitation states that forwarded types are not resolved in their implementing assemblies, since nothing is loaded.
  • compare_managed_members still pairs only methods and fields. When either side has exported types, it now adds a limitation saying they were not compared, so an empty diff of two facades is no longer silently misleading. Actually comparing forwarded sets is left for a follow-up.
  • docs/managed-code-analysis.md documents the new field.

This adds a field to an advertised output schema. Member Evidence recorded before this change has no such field; it parses as exported_types: null (table not examined) instead of being rejected, and comparisons add a limitation saying that side's exported types are unknown. npm run docs:generate produced no tracked changes because the generated catalogs are ignored outputs.

Validation

  • ManagedPe.fixture.ts can now emit ExportedType rows. New tests in src/dotnet/ManagedMemberInspector.test.ts cover a forwarder to AssemblyRef 1, a nested exported type, and an out-of-range implementation index.
  • npm run test:focused passes on all managed source, boundary, and MCP tests: 26 files, 200 passed, 3 skipped.
  • The contract and catalog tests also pass: toolOutputReferences, localToolContracts, productCatalog, contractPresentation, and outputSchemaSemanticConstraints.
  • npm run check:fast and npm run docs:check pass.
  • Not run against a real Microsoft facade such as System.Runtime.dll; this macOS host has no .NET runtime installed.

🤖 Generated with Claude Code

Facade assemblies such as System.Runtime.dll provide their types only
through ExportedType rows (type forwarders), which member inspection
never read, so they reported complete coverage with no types. Report
each row as declared with its flags, forwarder bit, TypeDefId hint, and
implementation token, and record invalid or null implementation coded
indexes as partial coverage. Comparisons now state that exported types
are not compared when either side has them.

Fixes #1812

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T13:32:25.261958Z ddc837d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 585369e4e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/domain/managed/managedArtifact.ts Outdated
requires_mvid: cliMetadataGuidSchema.nullable(),
}),
types: z.array(managedTypeSchema),
exported_types: z.array(managedExportedTypeSchema),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve compatibility with existing member Evidence

Make this new field default to an empty array when parsing historical results. inspect_managed_members Evidence captured before this change has no exported_types, but the comparison, reconstruction, and graph workflows all reparse those records with managedMemberInspectionSchema; they will now reject otherwise valid authenticated local evidence before running.

AGENTS.md reference: AGENTS.md:L11-L11

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ac3eaf0. exported_types is now nullable().default(null). Member Evidence recorded before this change parses as null, meaning the table was not examined; I used null rather than [] so old Evidence doesn't claim the assembly exports nothing. The producer always emits an array. compare_managed_members adds a limitation when either side is null. A new test parses Evidence with the field stripped and checks that limitation.

Member Evidence recorded before ExportedType rows were read omits the
field. Parse it as null (not examined) instead of rejecting it, and
state in comparisons that such an observation's exported types are
unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac3eaf0672

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/dotnet/ManagedMemberInspector.ts Outdated
requires_mvid: null,
},
types: [],
exported_types: [],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mark unexamined exported types as unknown

When the input is native, has malformed metadata, or exhausts the representation budget, unavailable is returned before parseExportedTypes runs, but this initializes the new field to []. That contradicts the new null meaning (“table was not examined”) and lets consumers interpret unavailable evidence as an observed empty ExportedType table; set it to null in this branch so forwarders remain unknown.

AGENTS.md reference: AGENTS.md:L17-L17

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ddc837d. The unavailable branch (native PE, malformed metadata, exhausted budget) now reports exported_types: null, because that path never reads the table. A new test checks this on a native PE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kaoru0822-kitauji
kaoru0822-kitauji merged commit ed1519d into main Oct 11, 2026
31 checks passed
@kaoru0822-kitauji
kaoru0822-kitauji deleted the fix/managed-exported-types branch October 11, 2026 14:02
@github-actions github-actions Bot mentioned this pull request Oct 11, 2026
3 tasks done
@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Verification follow-up for #1812: the official Microsoft .NET 7.0.20 System.Runtime.dll facade (SHA-256 c9f4dfd660e0b5fe56845493fe376a7c6b7fb3116735a51914088a1374b209c8) now reports all 861 exported types through both the public CLI and production stdio MCP: 831 AssemblyRef targets and 30 nested ExportedType targets. Local types remain separately reported; coverage is complete. Managed inspector and MCP schema regression tests passed. This verifies static metadata handling on Linux, without claiming Windows runtime or provider execution.

@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] inspect-managed-members reports .NET facade assemblies as complete with zero types because exported (forwarded) types are never parsed

3 participants