Implement GetCurrentAppDomain for cDAC#124996
Conversation
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
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
IXCLRDataAppDomainCOM interface andClrDataAppDomainwrapper type. - Implement
ClrDataTask.GetCurrentAppDomainby reading the AppDomain global and returning aClrDataAppDomain. - Update several
IXCLRData*signatures to useIXCLRDataAppDomain*/IXCLRDataAppDomain**instead ofvoid*/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; | ||
| } | ||
|
|
There was a problem hiding this comment.
_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.
| internal Target Target | |
| => _target; | |
| internal TargetPointer AppDomainHandle | |
| => _appDomain; |
| using System; | ||
| using System.Diagnostics; |
There was a problem hiding this comment.
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.
| using System; | |
| using System.Diagnostics; | |
| using System; | |
| #if DEBUG | |
| using System.Diagnostics; | |
| #endif |
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; |
There was a problem hiding this comment.
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).
| using System; |
Implement GetCurrentAppDomain for cDAC