Skip to content

Implement IXCLRDataProcess with existing cDAC contracts - #130954

Merged
rcj1 merged 10 commits into
mainfrom
copilot/add-support-for-logging
Jul 24, 2026
Merged

rcj1 merged 10 commits into
mainfrom
copilot/add-support-for-logging

Conversation

Copilot AI commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Moves consumer-used IXCLRDataProcess APIs from legacy fallback to cDAC where existing contracts provide equivalent behavior.

  • Implemented
    • App-domain and module enumeration/lookup
    • Task lookup, address classification, and GetDataByAddress
  • Compatibility
    • Preserves native HRESULT, enumeration, and child-wrapper behavior
  • Deferred
    • FollowStub/FollowStub2 require new stub-tracing contracts
    • EndEnumMethodDefinitionsByAddress depends on its legacy-owned enumeration handle

Note

This description was generated by GitHub Copilot.

Copilot AI requested review from Copilot and removed request for Copilot July 17, 2026 05:37
Copilot finished work on behalf of rcj1 July 17, 2026 05:38
Copilot AI requested a review from rcj1 July 17, 2026 05:38
@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 temporarily deployed to copilot-pat-pool July 17, 2026 05:40 Inactive
Copilot AI temporarily deployed to copilot-pat-pool July 17, 2026 05:41 Inactive
Copilot AI requested review from Copilot and removed request for Copilot July 17, 2026 06:19
Copilot stopped work on behalf of rcj1 due to an error July 17, 2026 06:40
Copilot AI requested review from Copilot and removed request for Copilot July 17, 2026 07:20
Copilot finished work on behalf of rcj1 July 17, 2026 07:22
Copilot AI requested review from Copilot and removed request for Copilot July 17, 2026 11:20
Copilot finished work on behalf of rcj1 July 17, 2026 11:30
Copilot finished work on behalf of rcj1 July 17, 2026 12:48
Copilot finished work on behalf of rcj1 July 17, 2026 13:44

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 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 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please remove one layer of indirection with the global stub data descriptors, that is, have the data descriptors contain the actual addresses instead of pointers to them an...

Implemented in c7d5980. Global stub descriptors now contain the entrypoint addresses directly, and the managed reader and tests consume those values without an additional dereference.

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 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/SOSDacImpl.IXCLRDataProcess.cs:322

  • StartEnumAppDomains invokes the legacy DAC when _legacyProcess is non-null, but it doesn't honor LegacyFallbackHelper.CanFallback(). In CDAC_NO_FALLBACK mode that means we still run legacy enumeration (and later EndEnum) even though fallback should be blocked.

Please gate the legacy Start/End calls (and similar patterns in StartEnumModules/Enum*/EndEnum* that were added in this PR) behind LegacyFallbackHelper.CanFallback() so no-fallback runs stay "pure" cDAC.

            *handle = 0;
            if (_legacyProcess is not null)
            {
                hrLocal = _legacyProcess.StartEnumAppDomains(&legacyHandle);
            }
  • Files reviewed: 12/12 changed files
  • Comments generated: 2

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.

rcj1 and others added 2 commits July 23, 2026 09:26
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@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

  • Files reviewed: 12/12 changed files
  • Comments generated: 3

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 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 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/SOSDacImpl.IXCLRDataProcess.cs:88

  • GetTaskByUniqueID unconditionally calls into _legacyProcess when it’s present. This bypasses the LegacyFallbackHelper.CanFallback() gate (used throughout this file) and defeats CDAC_NO_FALLBACK=1 semantics, which are meant to prevent legacy DAC delegation except for allowlisted methods (see LegacyFallbackHelper.cs). Consider gating the legacy call (and the DEBUG hr validation) behind LegacyFallbackHelper.CanFallback() so no-fallback runs don’t invoke legacy DAC.
        if (_legacyProcess is not null)
        {
            DacComNullableByRef<IXCLRDataTask> legacyTaskOut = new(isNullRef: task.IsNullRef);
            hrLocal = _legacyProcess.GetTaskByUniqueID(taskID, legacyTaskOut);
            legacyTask = legacyTaskOut.Interface;
        }

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs:322

  • These new IXCLRDataProcess implementations call into _legacyProcess without going through LegacyFallbackHelper.CanFallback() (e.g., StartEnumAppDomains, EnumAppDomain, GetAppDomainByUniqueID, StartEnumModules, EnumModule, GetModuleByAddress). If CDAC_NO_FALLBACK=1 is intended to prevent any legacy DAC use outside the allowlist (LegacyFallbackHelper.cs), these code paths should be gated similarly; otherwise no-fallback runs will still invoke the legacy DAC. Be careful to keep the enum-handle plumbing consistent if legacy calls are skipped (e.g., avoid calling legacy Enum* with a 0 handle and only run DEBUG hr validation when the legacy call actually happened).
            if (_legacyProcess is not null)
            {
                hrLocal = _legacyProcess.StartEnumAppDomains(&legacyHandle);
            }
  • Files reviewed: 11/11 changed files
  • Comments generated: 0 new

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/SOSDacImpl.IXCLRDataProcess.cs:446

  • When appDomain is a null COM out parameter (IsNullRef == true), this method currently evaluates Loader.GetAppDomain() and allocates a ClrDataAppDomain before the Interface setter throws. That can change the returned HRESULT (e.g., if contract access throws) and does unnecessary target reads/allocations. Consider explicitly checking appDomain.IsNullRef up front to return E_POINTER consistently and match the pattern used by EnumAppDomain/EnumModule.
        try
        {
            if (id != ClrDataAppDomain.DefaultAppDomainId)
                throw new ArgumentException();

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

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/IXCLRData.cs:212

  • This changes the public IXCLRDataProcess.GetAddressType signature from a uint* to a new enum pointer (CLRDataAddressType*) and introduces a new public enum type. If Microsoft.Diagnostics.DataContractReader.Legacy is considered public surface, this needs the normal API-approval workflow (or the change should be kept internal / avoid signature changes).
    int SetDesiredExecutionState(uint state);

    [PreserveSig]
    int GetAddressType(ClrDataAddress address, CLRDataAddressType* type);

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs:1009

  • GetDataByAddress no longer delegates to the legacy DAC when _legacyProcess is available; it now always returns E_NOTIMPL (flags==0) or E_INVALIDARG. This is a behavioral change from the previous implementation and seems at odds with the PR description calling out GetDataByAddress as implemented/preserved.

If the intention is to preserve legacy behavior when possible, consider keeping the legacy delegation path (or update the PR description to clearly state this method is intentionally stubbed to those HRESULTs).

    {
        int hr = flags == 0 ? HResults.E_NOTIMPL : HResults.E_INVALIDARG;

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

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

  • Files reviewed: 15/15 changed files
  • Comments generated: 0 new

@rcj1

rcj1 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

/ba-g timeout

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.

6 participants