Skip to content

Implement CLRDataMethodDefinition IL extent APIs in cDAC - #131384

Open
rcj1 with Copilot wants to merge 9 commits into
mainfrom
copilot/implement-clrdata-methods
Open

Implement CLRDataMethodDefinition IL extent APIs in cDAC#131384
rcj1 with Copilot wants to merge 9 commits into
mainfrom
copilot/implement-clrdata-methods

Conversation

Copilot AI commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Implements IL extent enumeration and representative entry-address lookup for CLRDataMethodDefinition, replacing legacy fallback behavior.

  • Implementation

    • Adds StartEnumExtents, EnumExtent, EndEnumExtents, and GetRepresentativeEntryAddress.
    • Preserves legacy DAC semantics for tiny/fat IL headers and single-shot enumeration.
  • Validation

    • Covers invalid arguments, missing IL, and tiny/extended-fat headers.

Note

This description was generated by GitHub Copilot.

Copilot AI and others added 3 commits July 26, 2026 02:50
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 26, 2026 03:05

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 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: rcj1 <77995559+rcj1@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 26, 2026 03:06

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI changed the title Implement CLRDataMethodDefinition IL extents in cDAC Implement CLRDataMethodDefinition IL extent APIs in cDAC Jul 26, 2026
Copilot finished work on behalf of rcj1 July 26, 2026 03:07
Copilot AI requested a review from rcj1 July 26, 2026 03:07
Copilot AI review requested due to automatic review settings July 26, 2026 18:58

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.

Copilot's findings

Comments suppressed due to low confidence (1)

src/native/managed/cdac/tests/UnitTests/IXCLRDataProcessTests.cs:252

  • The test currently writes the fat header CodeSize using the target endianness (arch.IsLittleEndian), but IL headers are fixed little-endian (ECMA-335) and the implementation should be reading via ReadLittleEndian. Encoding the header this way can let big-endian tests pass even if the production code is incorrectly using target-endian reads.
            secondHeader[codeSizeByteOffset] = FatCodeSize;
  • Files reviewed: 4/4 changed files
  • Comments generated: 1

Copilot AI review requested due to automatic review settings July 26, 2026 19:05

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI review requested due to automatic review settings July 26, 2026 19:09
@rcj1
rcj1 marked this pull request as ready for review July 26, 2026 19:13
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 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.

Copilot's findings

Comments suppressed due to low confidence (2)

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataMethodDefinition.cs:422

  • StartEnumExtents dereferences handle before validating it. Other similar COM enumeration entrypoints (e.g., ClrDataMethodInstance.StartEnumExtents) explicitly check for null and throw ArgumentNullException to reliably return E_POINTER without relying on null-pointer deref behavior.
        try
        {
            *handle = 0;
            TargetPointer code = GetILExtentStart(out uint codeSize);
            if (code == TargetPointer.Null)

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/IXCLRData.cs:934

  • This change introduces a new public enum and changes the public field type of ClrDataMethodDefinitionExtent.type from uint to CLRDataMethodDefinitionExtentType. That is a source-breaking public surface change for any consumers of the (packable) Legacy assembly. If this API is intended to be public, it should follow the repo’s public API approval process; otherwise consider keeping the field as uint (with a comment or helper cast) or making the enum/internal surface non-public.
public enum CLRDataMethodDefinitionExtentType : uint
{
    CLRDATA_METHDEF_IL,
}

public struct ClrDataMethodDefinitionExtent
{
    public ClrDataAddress startAddress;
    public ClrDataAddress endAddress;
    public uint enCVersion;
    public CLRDataMethodDefinitionExtentType type;
}
  • Files reviewed: 8/8 changed files
  • Comments generated: 2

Comment thread src/native/managed/cdac/tests/UnitTests/IXCLRDataProcessTests.cs
Copilot AI review requested due to automatic review settings July 26, 2026 19:16

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

}

#if DEBUG
if (LegacyFallbackHelper.CanFallback() && _legacyImpl is not null)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we normally check this for debug validation, it just controls whether the production code is allowed to fall back. (Same pattern in other DEBUG blocks below)

Copilot AI review requested due to automatic review settings July 27, 2026 23:25
@rcj1
rcj1 enabled auto-merge (squash) July 27, 2026 23:26

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.

Copilot's findings

Comments suppressed due to low confidence (1)

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/IXCLRData.cs:934

  • This change introduces new public API surface in the Legacy COM projections (new public enum CLRDataMethodDefinitionExtentType and changing ClrDataMethodDefinitionExtent.type from uint to that enum). The PR description doesn’t link an api-approved issue as required for new public APIs. If this is intended to avoid API review, consider keeping the struct field as uint (matching the prior surface) and using an internal enum/consts for readability, or link the approved API issue.
public enum CLRDataMethodDefinitionExtentType : uint
{
    CLRDATA_METHDEF_IL,
}

public struct ClrDataMethodDefinitionExtent
{
    public ClrDataAddress startAddress;
    public ClrDataAddress endAddress;
    public uint enCVersion;
    public CLRDataMethodDefinitionExtentType type;
}
  • Files reviewed: 8/8 changed files
  • Comments generated: 1

Comment on lines 6 to 10
public static class CorDbgHResults
{
public const int E_UNEXPECTED = unchecked((int)0x8000FFFF);
public const int CORDBG_E_NOTREADY = unchecked((int)0x80131c10);
public const int CORDBG_E_BAD_THREAD_STATE = unchecked((int)0x8013132d);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants