Skip to content

Implement IXCLRDataExceptionState.GetManagedObject in cDAC#131334

Open
rcj1 with Copilot wants to merge 3 commits into
mainfrom
copilot/implement-ixclrdataexceptionstate-getmanagedobject
Open

Implement IXCLRDataExceptionState.GetManagedObject in cDAC#131334
rcj1 with Copilot wants to merge 3 commits into
mainfrom
copilot/implement-ixclrdataexceptionstate-getmanagedobject

Conversation

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Implements managed exception object retrieval in cDAC with legacy DAC-compatible behavior.

  • Object materialization
    • Resolves the thrown-object handle into a ClrDataValue.
    • Preserves object sizing semantics.
  • Error handling
    • Maps null or unreadable handles to E_INVALIDARG using cDAC exception conventions.
    • Preserves E_POINTER for null output parameters.
  • Legacy validation
    • Compares HRESULTs against the legacy DAC in debug builds.
    • Retains the legacy value for downstream validation.

Note

This description was generated with GitHub Copilot.

Copilot AI and others added 2 commits July 24, 2026 17:24
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 24, 2026 17:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@rcj1
rcj1 marked this pull request as ready for review July 24, 2026 18:12
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

int hr = HResults.S_OK, hrLocal = HResults.S_OK;
IXCLRDataValue? legacyValue = null;

if (_legacyImpl is not null)

@noahfalk noahfalk Jul 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We shouldn't fallback to the legacy implementation without first testing LegacyFallbackHelper.CanFallback(). Is it useful to have a partial implementation of this method that still relies on the fallback? It seems a little clearer if we left the previous fallback behavior in place until we had an implementation that didn't rely on any fallback.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like we didn’t update the debug validation to test CanFallback() anywhere, I will do that here and then put up a PR to do that everywhere

Copilot AI review requested due to automatic review settings July 24, 2026 23:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment on lines +267 to +271
uint locationFlags;
ClrDataAddress location;
Assert.Equal(HResults.S_OK, value.Interface.GetLocationByIndex(0, &locationFlags, &location));
Assert.Equal(ClrDataVLocFlag.CLRDATA_VLOC_MEMORY, locationFlags);
Assert.Equal(s_exceptionObjectAddress.ToClrDataAddress(target), location);
Comment on lines +132 to +145
if (_thrownObjectHandle == TargetPointer.Null)
throw new ArgumentException();

TargetPointer exceptionObject;
try
{
exceptionObject = _target.ReadPointer(_thrownObjectHandle);
}
catch (VirtualReadException)
{
throw new ArgumentException();
}

ulong objectSize = _target.Contracts.Object.GetSize(exceptionObject);
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.

4 participants