Skip to content

Delegate.Method doesn't work with open instance delegates over methods on a generic type in CoreCLR #108619

Open
@SingleAccretion

Description

@SingleAccretion

Reproduction: godbolt.

Expected behavior: things work.
Actual behavior:

Unhandled exception. System.ArgumentException: Type handle 'Program+OpenInstanceDelStruct`1[System.Int32]&' and method handle with declaring type 'Program+OpenInstanceDelStruct`1[System.Int32]' are incompatible. Get RuntimeMethodHandle and declaring RuntimeTypeHandle off the same MethodBase.
   at System.RuntimeType.GetMethodBase(RuntimeType reflectedType, RuntimeMethodHandleInternal methodHandle)
   at System.Delegate.GetMethodImpl()
   at System.Diagnostics.DiagnosticMethodInfo.Create(Delegate delegate)
   at Program.Main() in /app/example.cs:line 11

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions