Skip to content

[cDAC] Avoid exception-based GetTypeParam probing - #130732

Merged
max-charlamb merged 1 commit into
dotnet:mainfrom
max-charlamb:max-charlamb/cdac-gettypeparam-guard
Jul 15, 2026
Merged

max-charlamb merged 1 commit into
dotnet:mainfrom
max-charlamb:max-charlamb/cdac-gettypeparam-guard

Conversation

@max-charlamb

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

Copy link
Copy Markdown
Member

Summary

  • Use the existing HasTypeParam predicate before calling GetTypeParam in SOS field descriptor projection.
  • Keep the same value-type descriptor and MethodTable output behavior without using ArgumentException as normal control flow.

Validation

  • dotnet build src\native\managed\cdac\cdac.slnx -c Debug -p:UseSharedCompilation=false /nr:false (final run: 0 warnings, 0 errors)
  • dotnet test src\native\managed\cdac\tests\UnitTests\Microsoft.Diagnostics.DataContractReader.Tests.csproj -c Debug --no-build (2697 passed, 16 skipped)
  • Targeted TypeDescTests run (16 passed)

Note

This PR was generated with the assistance of GitHub Copilot.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f2aa5dc4-0c99-43f0-af14-734143849c4a
@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

Updates the legacy cDAC SOS field descriptor projection logic to avoid using ArgumentException as control flow when determining whether a TypeHandle has a type parameter before calling GetTypeParam.

Changes:

  • Replaces try { GetTypeParam } catch (ArgumentException) probing with an explicit HasTypeParam check.
  • Preserves prior MTOfType selection behavior for arrays, type-descs-with-type-params, and non-array MethodTables.

@max-charlamb
max-charlamb marked this pull request as ready for review July 15, 2026 01:07
@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.

@max-charlamb
max-charlamb enabled auto-merge (squash) July 15, 2026 01:14
@max-charlamb
max-charlamb merged commit 2cf60d9 into dotnet:main Jul 15, 2026
89 checks passed
@max-charlamb
max-charlamb deleted the max-charlamb/cdac-gettypeparam-guard branch July 15, 2026 19:21
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 16, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 16, 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.

3 participants