Skip to content

ClrMD should stop using HResult as a PInvoke return #1015

@leculver

Description

@leculver

From dotnet/runtime#70099. .Net Core apparently runs on x86 for Linux which means that the HResult struct we use to make life easier in handling HRESULT from the dac's COM interfaces breaks when used as a return value in place of int.

We need to change all usages of HResult to not be directly in a PInvoke/reverse PInvoke signature. E.G. vtable->QueryInterface = (delegate* unmanaged[Stdcall]<IntPtr, in Guid, out IntPtr, HResult>)Marshal.GetFunctionPointerForDelegate(qi); needs to be int> instead of HResult>.

This will be a breaking change, so we'll need to version bump to 2.2. It shouldn't effect most people though, since very few people use the *.DacInterface namespace.

@t-mustafin I've ported the issue you reported here. Note that even if ClrMD changes this behavior we still need to check the CLR diagnostics codebase for the same pattern. I think @mikem8361 uses HResult in a few places in SOS...but I'm not sure whether he directly uses it as a return value for a pinvoke.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions