Skip to content

[cDAC] fix bug in DacDbi GetTypeHandle#127968

Merged
rcj1 merged 1 commit into
dotnet:mainfrom
rcj1:get-type-handle-bugfix
May 8, 2026
Merged

[cDAC] fix bug in DacDbi GetTypeHandle#127968
rcj1 merged 1 commit into
dotnet:mainfrom
rcj1:get-type-handle-bugfix

Conversation

@rcj1

@rcj1 rcj1 commented May 8, 2026

Copy link
Copy Markdown
Contributor

Return exception HResult when type not found

@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 updates the legacy cDAC DBI implementation of GetTypeHandle to return an error HRESULT when a TypeDef/TypeRef lookup does not resolve to a loaded type, aligning the managed implementation with the native DAC behavior (returning CORDBG_E_CLASS_NOT_LOADED instead of reporting success with a null/zero handle).

Changes:

  • Treat TypeDefToMethodTable / TypeRefToMethodTable lookup misses as failures by returning CORDBG_E_CLASS_NOT_LOADED.
  • Ensure the method doesn’t silently succeed when *pRetVal ends up as 0.
Show a summary per file
File Description
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs Make GetTypeHandle return CORDBG_E_CLASS_NOT_LOADED when the resolved type handle is zero (not found / not loaded).

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

@rcj1 rcj1 merged commit 421be95 into dotnet:main May 8, 2026
65 of 68 checks passed
@rcj1 rcj1 deleted the get-type-handle-bugfix branch May 8, 2026 21:44
jakobbotsch pushed a commit to jakobbotsch/runtime that referenced this pull request May 12, 2026
Return exception HResult when type not found
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 8, 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.

4 participants