Ignore AppDomain address parameters in ISOSDacInterface#129476
Ignore AppDomain address parameters in ISOSDacInterface#129476max-charlamb wants to merge 1 commit into
Conversation
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
This PR updates the SOS DAC (ISOSDacInterface) AppDomain-related APIs to stop trusting the caller-provided AppDomain address and instead query the current/default AppDomain directly (native DAC: AppDomain::GetCurrentDomain(), cDAC: ILoader.GetAppDomain()), reflecting CoreCLR’s single-AppDomain model.
Changes:
- Native DAC (
request.cpp):GetAppDomainData,GetAssemblyList, andGetAppDomainNamenow useAppDomain::GetCurrentDomain()and no longer validateaddr != 0. - cDAC (
SOSDacImpl.cs): the same methods now useloader.GetAppDomain()and no longer validateaddr != 0. - Removes
addr == 0precondition checks sinceaddris no longer used.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs | Switches AppDomain-dependent methods to use ILoader.GetAppDomain() instead of the input address. |
| src/coreclr/debug/daccess/request.cpp | Switches AppDomain-dependent methods to use AppDomain::GetCurrentDomain() instead of the input address. |
This comment has been minimized.
This comment has been minimized.
CoreCLR only has a single AppDomain. The addr/domain parameters passed to GetAppDomainData, GetAssemblyList, and GetAppDomainName are historical artifacts from the multi-AppDomain era. These methods now use AppDomain::GetCurrentDomain() (DAC) or ILoader.GetAppDomain() (cDAC) directly instead of trusting the caller-provided address. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
011b745 to
da24b3c
Compare
Copilot Code ReviewHolistic AssessmentMotivation: Well-justified follow-up to #129260. CoreCLR has exactly one AppDomain, so the Approach: Correct and minimal — replaces Summary: ✅ LGTM. Clean, focused change that correctly eliminates dead parameter usage in Detailed FindingsDetailed Findings✅ Correctness — Safe behavioral changeThe removal of In ✅ DAC/cDAC alignment — Consistent approachBoth native DAC and managed cDAC make the same logical change for all three methods. The cDAC 💡 Minor — HRESULT discrepancy in null-AppDomain error path (non-blocking)When This is non-blocking because:
If you wanted perfect parity, you could use ✅ Scope — Appropriately focused
Note This review was created by GitHub Copilot.
|
Note
This PR was created with assistance from GitHub Copilot.
CoreCLR only has a single AppDomain. The
addr/domainparameters passed toGetAppDomainData,GetAssemblyList, andGetAppDomainNameare historical artifacts from the multi-AppDomain era (.NET Framework). These methods now useAppDomain::GetCurrentDomain()(DAC) orILoader.GetAppDomain()(cDAC) directly instead of trusting the caller-provided address.Changes
DAC (
request.cpp):GetAppDomainData-- usesAppDomain::GetCurrentDomain()instead of castingaddrGetAssemblyList-- usesAppDomain::GetCurrentDomain()instead of castingaddrGetAppDomainName-- usesAppDomain::GetCurrentDomain()instead of castingaddrcDAC (
SOSDacImpl.cs):loader.GetAppDomain()instead of the input addressAll
addr == 0precondition checks are removed since the parameter is no longer used.Testing
All cDAC unit tests pass (2509 passed, 0 failed).
Follow-up from
#129260