Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
steveharter opened this issue Feb 1, 2024 · 1 comment · Fixed by #97909
Closed

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

steveharter opened this issue Feb 1, 2024 · 1 comment · Fixed by #97909
Assignees
Labels
area-VM-reflection-mono Reflection issues specific to MonoVM runtime-mono specific to the Mono runtime
Milestone

Comments

@steveharter
Copy link
Member

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
@steveharter steveharter added runtime-mono specific to the Mono runtime area-VM-reflection-mono Reflection issues specific to MonoVM labels Feb 1, 2024
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Feb 1, 2024
@lambdageek lambdageek added this to the 9.0.0 milestone Feb 3, 2024
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Feb 3, 2024
@lambdageek lambdageek self-assigned this Feb 3, 2024
@lambdageek
Copy link
Member

@steveharter the issue description is incorrect, right? The expected behavior is to allow the access, not to throw a FAE, right? The NativeAOT issue #97833 is correct?

lambdageek added a commit to lambdageek/runtime that referenced this issue Feb 3, 2024
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Feb 3, 2024
lambdageek added a commit that referenced this issue Feb 5, 2024
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Feb 5, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 7, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
area-VM-reflection-mono Reflection issues specific to MonoVM runtime-mono specific to the Mono runtime
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants