Skip to content

Implement GetCurrentAppDomain for cDAC#124996

Draft
barosiak wants to merge 2 commits intodotnet:mainfrom
barosiak:barosiak/GetCurrentAppDomain
Draft

Implement GetCurrentAppDomain for cDAC#124996
barosiak wants to merge 2 commits intodotnet:mainfrom
barosiak:barosiak/GetCurrentAppDomain

Conversation

@barosiak
Copy link
Member

@barosiak barosiak commented Feb 28, 2026

Implement GetCurrentAppDomain for cDAC

Copilot AI review requested due to automatic review settings February 28, 2026 01:04
@dotnet-policy-service
Copy link
Contributor

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

@barosiak barosiak marked this pull request as ready for review February 28, 2026 01:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements IXCLRDataTask.GetCurrentAppDomain for cDAC by introducing an IXCLRDataAppDomain COM interface and a managed wrapper, plus associated signature tighten-ups and a unit test.

Changes:

  • Add IXCLRDataAppDomain COM interface and ClrDataAppDomain wrapper type.
  • Implement ClrDataTask.GetCurrentAppDomain by reading the AppDomain global and returning a ClrDataAppDomain.
  • Update several IXCLRData* signatures to use IXCLRDataAppDomain*/IXCLRDataAppDomain** instead of void*/void**, and add a test validating the new API path.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/native/managed/cdac/tests/ClrDataTaskTests.cs Adds coverage for GetCurrentAppDomain returning an AppDomain object.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs Updates process interface method signatures to typed IXCLRDataAppDomain*/**.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/IXCLRData.cs Introduces IXCLRDataAppDomain and updates related interface signatures, including GetCurrentAppDomain.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataTask.cs Implements GetCurrentAppDomain using cDAC globals, with DEBUG parity assert vs legacy DAC.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataModule.cs Updates module interface method signatures to typed IXCLRDataAppDomain*/**.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataFrame.cs Adjusts GetAppDomain parameter annotation to clarify AppDomain type.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataAppDomain.cs Adds ClrDataAppDomain COM class wrapper (currently legacy-forwarding).

_appDomain = appDomain;
_legacyImpl = legacyImpl;
}

Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

_target and _appDomain are assigned but never used, which will raise CS0414 and fail the build (warnings treated as errors). Either remove these fields for now, or use them (e.g., implement at least one method using _appDomain / _target) and keep the state meaningful.

Suggested change
internal Target Target
=> _target;
internal TargetPointer AppDomainHandle
=> _appDomain;

Copilot uses AI. Check for mistakes.
Comment on lines 4 to +5
using System;
using System.Diagnostics;
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

using System.Diagnostics; is only referenced inside #if DEBUG. In non-Debug builds this becomes an unused using directive (CS8019) and will fail the build because the repo treats warnings as errors. Wrap the using in #if DEBUG or remove it and fully-qualify System.Diagnostics.Debug inside the #if DEBUG block.

Suggested change
using System;
using System.Diagnostics;
using System;
#if DEBUG
using System.Diagnostics;
#endif

Copilot uses AI. Check for mistakes.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

This file has an unused using System; directive. With TreatWarningsAsErrors=true at the repo level, CS8019 will break the build; please remove the unused using (or add a real usage if intended).

Suggested change
using System;

Copilot uses AI. Check for mistakes.
@barosiak barosiak marked this pull request as draft February 28, 2026 01:47
@barosiak barosiak marked this pull request as draft February 28, 2026 01:47
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.

2 participants