Uh oh!
There was an error while loading. Please reload this page.
Ignore AppDomain address parameters in ISOSDacInterface - #129476
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. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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
da24b3cCompareCopilot 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.
|
max-charlamb
commented
Jun 17, 2026
/azp run runtime-diagnostics |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
max-charlamb
commented
Jun 17, 2026
/ba-g SOSTests passed |
Uh oh!
There was an error while loading. Please reload this page.
> [!NOTE] > This PR was created with assistance from GitHub Copilot. CoreCLR only has a single AppDomain. The `addr`/`domain` parameters passed to `GetAppDomainData`, `GetAssemblyList`, and `GetAppDomainName` are historical artifacts from the multi-AppDomain era (.NET Framework). These methods now use `AppDomain::GetCurrentDomain()` (DAC) or `ILoader.GetAppDomain()` (cDAC) directly instead of trusting the caller-provided address. ### Changes **DAC (`request.cpp`):** - `GetAppDomainData` -- uses `AppDomain::GetCurrentDomain()` instead of casting `addr` - `GetAssemblyList` -- uses `AppDomain::GetCurrentDomain()` instead of casting `addr` - `GetAppDomainName` -- uses `AppDomain::GetCurrentDomain()` instead of casting `addr` **cDAC (`SOSDacImpl.cs`):** - Same 3 methods use `loader.GetAppDomain()` instead of the input address All `addr == 0` precondition checks are removed since the parameter is no longer used. ### Testing All cDAC unit tests pass (2509 passed, 0 failed). ### Follow-up from #129260 Successful runtime-diagnostics run: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1467096&view=results Co-authored-by: Max Charlamb <maxcharlamb@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Successful runtime-diagnostics run: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1467096&view=results