Skip to content

[cDAC] Validate global reads against descriptor types - #130725

Merged
max-charlamb merged 4 commits into
dotnet:mainfrom
max-charlamb:dev/max-charlamb/cdac-global-type-validation
Jul 16, 2026
Merged

max-charlamb merged 4 commits into
dotnet:mainfrom
max-charlamb:dev/max-charlamb/cdac-global-type-validation

Conversation

@max-charlamb

@max-charlamb max-charlamb commented Jul 14, 2026 •

Copy link
Copy Markdown
Member

Summary

  • validate numeric global reads against primitive descriptor types
  • validate pointer-width global reads against pointer, nint, and nuint descriptor types
  • share public type compatibility helpers between field and global validation
  • align StressLogMaxModules with its native nuint type
  • add coverage for global descriptor type compatibility

Fixes #126749

Testing

  • cDAC unit tests in Debug configuration
  • focused global type compatibility test (1 passed)
  • focused StressLog dump tests (6 passed, 6 skipped due to unavailable JIT dumps)

Note

This PR description was generated with GitHub Copilot.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens cDAC contract-descriptor global reading by adding debug-time validation that the requested read shape (numeric / pointer / string) matches the global’s descriptor type annotation, and refactors type-compatibility checks into a shared helper used by both field and global validation.

Changes:

  • Add debug assertions to ContractDescriptorTarget global read paths to validate descriptor type compatibility for numeric, pointer, and string reads.
  • Introduce TargetTypeHelpers to share compatibility logic between field validation (TargetFieldExtensions) and global validation.
  • Add new unit tests covering mismatched global read/type scenarios across target architectures.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/native/managed/cdac/tests/UnitTests/ContractDescriptor/TargetTests.cs Adjusts existing global stringy-value test data to avoid declaring a string type when a numeric interpretation is also provided.
src/native/managed/cdac/tests/UnitTests/ContractDescriptor/GlobalTypeValidationTests.cs Adds focused DEBUG-only tests to assert type-mismatch diagnostics for global reads.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader/ContractDescriptorTarget.cs Adds descriptor-type validation assertions and separates numeric global lookup from typed conversion paths.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/TargetTypeHelpers.cs Adds shared (currently public) helper methods for validating primitive/pointer/string type compatibility.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/TargetFieldExtensions.cs Refactors existing field-type validation to use the new shared helper methods.

@max-charlamb
max-charlamb requested a review from rcj1 July 14, 2026 20:44
@max-charlamb
max-charlamb marked this pull request as ready for review July 14, 2026 20:45
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI review requested due to automatic review settings July 15, 2026 02:23
@max-charlamb
max-charlamb force-pushed the dev/max-charlamb/cdac-global-type-validation branch from 1d60916 to 495c99d Compare July 15, 2026 02:23
@max-charlamb
max-charlamb marked this pull request as draft July 15, 2026 02:23
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 03cf8dec-e644-4631-8802-f2b3fccd523a
@max-charlamb
max-charlamb force-pushed the dev/max-charlamb/cdac-global-type-validation branch from 495c99d to 2d6cc69 Compare July 15, 2026 02:26
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 03cf8dec-e644-4631-8802-f2b3fccd523a

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Copilot AI review requested due to automatic review settings July 15, 2026 02:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Comment thread docs/design/datacontracts/StressLog.md Resolved
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 03cf8dec-e644-4631-8802-f2b3fccd523a
Copilot AI review requested due to automatic review settings July 15, 2026 02:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

@max-charlamb
max-charlamb marked this pull request as ready for review July 15, 2026 13:38
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
10 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 03cf8dec-e644-4631-8802-f2b3fccd523a
Copilot AI review requested due to automatic review settings July 15, 2026 13:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

@max-charlamb
max-charlamb merged commit 9e49d49 into dotnet:main Jul 16, 2026
141 of 143 checks passed
@max-charlamb
max-charlamb deleted the dev/max-charlamb/cdac-global-type-validation branch July 16, 2026 19:56
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 17, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cDAC] Follow-up items from PR #126713 (typed field extension methods)

3 participants