Skip to content

Setting\getting a function pointer field with reflection not supported #97830

Closed
@steveharter

Description

@steveharter

In the Core runtime, a FieldAccessException is thrown.

Found by newly added tests in #97784

Repro

FieldInfo fieldInfo = typeof(MyStruct).GetField(nameof(MyStruct.fcnPtr));
fieldInfo.SetValue(new MyStruct(), (IntPtr)200);
// Result: assert or does nothing

public struct MyStruct
{
    public unsafe delegate*<void> fcnPtr = (delegate*<void>)44;

    public MyStruct() { }
}

Asserts include

type 0x1b not handled in ves_icall_FieldInfo_SetValueInternal
type 0x1b not handled in mono_field_get_value_object

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions