Repository navigation
Restore CLR RAR metadata validation for malformed hash blobs - #15217
Conversation
Preserve the legacy metadata-read failure by requesting both unused hash outputs in GetAssemblyRefProps. Add synthetic regressions for malformed hash blobs and maximum-version references with valid hashes. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The narrow compatibility fix preserves existing failure handling and includes focused regression coverage, with no blocking issues identified.
Review effort: Balanced
Findings: None
What changed in this PR
Restores legacy malformed-hash validation in RAR’s Windows/.NET Framework metadata reader without changing the PEReader path.
Changes:
- Requests hash outputs in both
GetAssemblyRefPropscalls to preserve existing metadata-read failures. - Adds generated fixtures covering malformed hashes and maximum-version references with valid hashes.
| File | Description |
|---|---|
| src/Tasks/AssemblyDependency/AssemblyInformation.cs | Restores hash output arguments for CLR metadata validation. |
| src/Tasks.UnitTests/AssemblyDependency/AssemblyInformation_Tests.cs | Adds malformed-hash regression coverage and a valid-hash control. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
| # | Dimension | Verdict |
|---|---|---|
| 4 | Test Coverage & Completeness | 🟡 1 MODERATE |
✅ 23/24 dimensions clean.
- Test Coverage — make the positive control use a real, non-empty valid hash blob.
The product change is narrowly scoped and consistent with the legacy CLR metadata-reader behavior restored from before #13853. No merge-blocking correctness, compatibility, concurrency, performance, API, diagnostic, or cross-platform issue was found.
Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
github.comraw.githubusercontent.com
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "github.com"
- "raw.githubusercontent.com"See Network Configuration for more information.
Generated by Expert Code Review (on open) for #15217 · copilot · gpt56 · 866.4 AIC · ⌖ 4.56 AIC · ⊞ 24.9K
VS customer reports: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/3049117/
Regression introduced by #13853.
Context
The CLR metadata interop migration changed unused
GetAssemblyRefPropshash outputs from real output locations tonull. On assemblies with an invalid AssemblyRef hash-blob index, this bypasses the metadata-read failure that RAR previously handled nonfatally. RAR then traverses newly exposed dependencies, potentially excluding a previously resolved primary reference with MSB3258 or emitting MSB3277 that breaks warning-as-error builds.Changes Made
Compatibility
Limited to the Windows/.NET Framework CLR metadata reader. The .NET PEReader path is unchanged. No new diagnostics, defaults, APIs or protocols are introduced.
This deliberately restores the existing all-or-nothing dependency-read fallback: a malformed hash can abandon dependency traversal while retaining the primary reference. It does not blanket-ignore version 65535, continue with a partial dependency array, or undo the later COM activation/lifetime fixes.
Testing
The new malformed-hash regression failed against unpatched local source and passed after restoring the hash outputs. A separate valid-hash control retained the preexisting maximum-version rejection behavior.
Passed: full repository build, 0 warnings and 0 errors. An initial run encountered CS0009 in a malformed generated
ExampleTaskX86reference assembly; rebuilding that fixture repaired the generated output, and the full retry passed without product changes.Passed: 10 tests, 0 failures, 0 skipped (net472/x86).
Passed: 4 tests, 0 failures, 0 skipped (net472/x86).
Coverage gaps: the complete Tasks test suite and required CI matrix have not been run locally. Type-library generation was disabled for the dotnet-engine build.
Dependencies and Follow-up
No companion-PR dependency. This is a candidate for backporting to affected servicing branches. A deliberate malformed-metadata recovery policy, including any partial dependency traversal or cross-runtime behavior change, should be evaluated separately with compatibility/ChangeWave discipline.