Repository navigation
Implement IXCLRDataProcess with existing cDAC contracts - #130954
Conversation
Co-authored-by: rcj1 <[email protected]>
|
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. |
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. |
There was a problem hiding this comment.
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
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
|
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. |
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (2)
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs:88
GetTaskByUniqueIDunconditionally calls into_legacyProcesswhen it’s present. This bypasses theLegacyFallbackHelper.CanFallback()gate (used throughout this file) and defeatsCDAC_NO_FALLBACK=1semantics, 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) behindLegacyFallbackHelper.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
_legacyProcesswithout going throughLegacyFallbackHelper.CanFallback()(e.g.,StartEnumAppDomains,EnumAppDomain,GetAppDomainByUniqueID,StartEnumModules,EnumModule,GetModuleByAddress). IfCDAC_NO_FALLBACK=1is 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 legacyEnum*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
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs:446
- When
appDomainis a null COM out parameter (IsNullRef == true), this method currently evaluatesLoader.GetAppDomain()and allocates aClrDataAppDomainbefore theInterfacesetter throws. That can change the returned HRESULT (e.g., if contract access throws) and does unnecessary target reads/allocations. Consider explicitly checkingappDomain.IsNullRefup front to return E_POINTER consistently and match the pattern used byEnumAppDomain/EnumModule.
try
{
if (id != ClrDataAppDomain.DefaultAppDomainId)
throw new ArgumentException();
- Files reviewed: 13/13 changed files
- Comments generated: 1
There was a problem hiding this comment.
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.GetAddressTypesignature from auint*to a new enum pointer (CLRDataAddressType*) and introduces a new public enum type. IfMicrosoft.Diagnostics.DataContractReader.Legacyis 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
GetDataByAddressno longer delegates to the legacy DAC when_legacyProcessis available; it now always returnsE_NOTIMPL(flags==0) orE_INVALIDARG. This is a behavioral change from the previous implementation and seems at odds with the PR description calling outGetDataByAddressas 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
|
/ba-g timeout |
Moves consumer-used
IXCLRDataProcessAPIs from legacy fallback to cDAC where existing contracts provide equivalent behavior.GetDataByAddressFollowStub/FollowStub2require new stub-tracing contractsEndEnumMethodDefinitionsByAddressdepends on its legacy-owned enumeration handleNote
This description was generated by GitHub Copilot.