diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c index c48f2b1199a0d..04479684a6125 100644 --- a/src/mono/mono/metadata/icall.c +++ b/src/mono/mono/metadata/icall.c @@ -6293,6 +6293,11 @@ ves_icall_System_Environment_get_TickCount64 (void) gpointer ves_icall_RuntimeMethodHandle_GetFunctionPointer (MonoMethod *method, MonoError *error) { + /* WISH: we should do this in managed */ + if (G_UNLIKELY (mono_method_has_unmanaged_callers_only_attribute (method))) { + method = mono_marshal_get_managed_wrapper (method, NULL, (MonoGCHandle)0, error); + return_val_if_nok (error, NULL); + } return mono_get_runtime_callbacks ()->get_ftnptr (method, error); } diff --git a/src/mono/mono/mini/interp/interp.c b/src/mono/mono/mini/interp/interp.c index 6a0039ca872d7..be586a546ed86 100644 --- a/src/mono/mono/mini/interp/interp.c +++ b/src/mono/mono/mini/interp/interp.c @@ -6542,9 +6542,16 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; MonoMethod *cmethod = LOCAL_VAR (ip [2], MonoMethod*); - InterpMethod *m = mono_interp_get_imethod (cmethod, error); - mono_error_assert_ok (error); - LOCAL_VAR (ip [1], gpointer) = imethod_to_ftnptr (m, FALSE); + if (G_UNLIKELY (mono_method_has_unmanaged_callers_only_attribute (cmethod))) { + cmethod = mono_marshal_get_managed_wrapper (cmethod, NULL, (MonoGCHandle)0, error); + mono_error_assert_ok (error); + gpointer addr = mini_get_interp_callbacks ()->create_method_pointer (cmethod, TRUE, error); + LOCAL_VAR (ip [1], gpointer) = addr; + } else { + InterpMethod *m = mono_interp_get_imethod (cmethod, error); + mono_error_assert_ok (error); + LOCAL_VAR (ip [1], gpointer) = imethod_to_ftnptr (m, FALSE); + } ip += 3; MINT_IN_BREAK; }