Repository navigation
fix(managed): classify ReadyToRun images without ILONLY as modern .NET - #2075
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
crossgen2 clears COMIMAGE_FLAGS_ILONLY and sets IL_LIBRARY on ReadyToRun output. inspect_managed_artifact checked the clear ILONLY flag before the ReadyToRun signature, so real ReadyToRun assemblies were reported as runtime_family mixed-clr-native and implementation cpp-cli-mixed, and cil-and-ready-to-run was unreachable for crossgen2 output. Check the ReadyToRun signature first; a clear ILONLY flag without it still reports mixed CLR/native code.
fe408fd to
4a459da
Compare
|
@greptileai review |
|
|
Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open. Source changes are on acaa88f. Complete and partial metadata paths share the header-owned ReadyToRun/mixed-runtime classification, so ILONLY-clear ReadyToRun images remain modern .NET after a capacity failure. The capacity regression now enlarges an assembly-reference name that inspectManagedArtifactBytes actually decodes, replacing the unread field-name fixture; the intended fallback and assertion are source-grounded but unexecuted. Source inspection and git diff checks completed. Tests, typecheck/lint, generated-schema checks and real-provider lanes were not run for this final revision at the user's explicit request. |
morluto#2075) * fix(managed): classify ReadyToRun images without ILONLY as modern .NET crossgen2 clears COMIMAGE_FLAGS_ILONLY and sets IL_LIBRARY on ReadyToRun output. inspect_managed_artifact checked the clear ILONLY flag before the ReadyToRun signature, so real ReadyToRun assemblies were reported as runtime_family mixed-clr-native and implementation cpp-cli-mixed, and cil-and-ready-to-run was unreachable for crossgen2 output. Check the ReadyToRun signature first; a clear ILONLY flag without it still reports mixed CLR/native code. * test(managed): exhaust capacity through inspected assembly references --------- Co-authored-by: morluto <[email protected]>
Summary
inspect_managed_artifactmisclassifies real ReadyToRun assemblies as C++/CLI mixed-mode images. crossgen2 clearsCOMIMAGE_FLAGS_ILONLY(and setsCOMIMAGE_FLAGS_IL_LIBRARY) on ReadyToRun output. The classifier checks the clear ILONLY flag before the ReadyToRun signature, so every crossgen2 image reports:runtime_family: "mixed-clr-native"withcli-il-only-clearevidenceimplementation: "cpp-cli-mixed"As a result,
cil-and-ready-to-runis unreachable for actual crossgen2 output. The existing ReadyToRun fixtures pass because they keep the fixture defaultcliFlags: 1(ILONLY set).No linked issue: I found this while running the managed inspectors over the .NET 8 SDK (8.0.425, osx-arm64) on macOS.
Problem and expected behavior
Before, for
shared/Microsoft.NETCore.App/8.0.31/Microsoft.CSharp.dll(CLI flags0xc= IL_LIBRARY | STRONGNAMESIGNED, ReadyToRun signature present):{"runtime_family":"mixed-clr-native","implementation":"cpp-cli-mixed","managed_architecture":"arm64","evidence":["cli-header-observed","cli-il-only-clear","managed-architecture-derived"]}After:
{"runtime_family":"modern-dotnet","implementation":"cil-and-ready-to-run","managed_architecture":"arm64","evidence":["cli-header-observed","ready-to-run-signature-observed","managed-architecture-derived"]}Across the 595 uniquely named DLLs in that SDK, all 330 ReadyToRun images had the first classification; they now have the second. The IL-only and metadata-only assemblies are unchanged.
A C++/CLI image has no ReadyToRun header, so the ReadyToRun signature can safely take precedence over the ILONLY flag.
Change and scope
implementationForchecks the ReadyToRun signature before the ILONLY flag.runtimeFamilyFortakes themixed-clr-nativebranch only when ILONLY is clear and there is no ReadyToRun signature. ReadyToRun images then reach the existingready-to-run-signature-observed/modern-dotnetbranch.managed_architecturederivation and the native-boundary inspector are unchanged. (mixed_mode_or_native_headeralready reportstruefor a native header.)Contract and boundary impact
src/dotnet/ManagedArtifactInspector.tsclassificationcli-il-only-clearEvidence and regression coverage
Tests added or updated:
src/dotnet/ManagedArtifactInspector.test.tsadds "managed implementation classification":cliFlags: 0xcclassifies asmodern-dotnet/cil-and-ready-to-runwithoutcli-il-only-clearevidencemixed-clr-native/cpp-cli-mixedBase reproduction or other evidence: the ReadyToRun case fails on
d864ad5and passes with this change. The SDK scan results above were run before and after.User-visible CLI/MCP output: shown above (
rea inspect-managed-artifact <Microsoft.CSharp.dll> --format json)Remaining proof gaps: I have no real C++/CLI assembly on this host. The mixed-mode branch is covered by the fixture only.
Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
npx vitest run src/dotnet: 185 passednpx vitest run tests/acceptance/managedCliOutput.test.ts: 5 passednpm run check:fast: passednpx oxfmt --checkon the changed files: cleaninspectManagedArtifactBytes/inspectManagedMembersBytes/inspectManagedNativeBoundariesBytesover the SDK's 595 unique DLLs: no exceptions, and the classification counts described aboveCompatibility, safety, and release
cpp-cli-mixed/mixed-clr-nativefor ReadyToRun assemblies now getcil-and-ready-to-run/modern-dotnet, which is the documented value for those imagesReview checklist
type(scope): outcome.