diff --git a/src/libraries/System.Reflection/tests/MethodInfoTests.cs b/src/libraries/System.Reflection/tests/MethodInfoTests.cs index 16ba988a5258b..886194492c50e 100644 --- a/src/libraries/System.Reflection/tests/MethodInfoTests.cs +++ b/src/libraries/System.Reflection/tests/MethodInfoTests.cs @@ -896,7 +896,6 @@ private static void SecondCall(MethodInfo mi) [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/71883", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/82272", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser))] private static unsafe void TestFunctionPointers() { void* fn = FunctionPointerMethods.GetFunctionPointer(); diff --git a/src/mono/mono/mini/jit-icalls.c b/src/mono/mono/mini/jit-icalls.c index 93802f47b34e9..a22a36ea98f5b 100644 --- a/src/mono/mono/mini/jit-icalls.c +++ b/src/mono/mono/mini/jit-icalls.c @@ -21,6 +21,7 @@ #include "jit-icalls.h" #include "aot-runtime.h" #include "mini-runtime.h" +#include "llvmonly-runtime.h" #include #include #include @@ -42,17 +43,19 @@ mono_ldftn (MonoMethod *method) if (mono_llvm_only) { // FIXME: No error handling + if (mono_method_signature_internal (method)->pinvoke) { + addr = mono_compile_method_checked (method, error); + mono_error_assert_ok (error); + g_assert (addr); - addr = mono_compile_method_checked (method, error); - mono_error_assert_ok (error); - g_assert (addr); - - if (mono_method_needs_static_rgctx_invoke (method, FALSE)) - /* The caller doesn't pass it */ - g_assert_not_reached (); + return addr; + } else { + /* Managed function pointers are ftndesc's */ + addr = mini_llvmonly_load_method_ftndesc (method, FALSE, FALSE, error); + mono_error_assert_ok (error); - addr = mini_add_method_trampoline (method, addr, mono_method_needs_static_rgctx_invoke (method, FALSE), FALSE); - return addr; + return addr; + } } /* if we need the address of a native-to-managed wrapper, just compile it now, trampoline needs thread local