[mono] Fix the error handling in a call to interp_create_method_pointer (). (#56883)
authorZoltan Varga <vargaz@gmail.com>
Thu, 5 Aug 2021 13:40:18 +0000 (09:40 -0400)
committerGitHub <noreply@github.com>
Thu, 5 Aug 2021 13:40:18 +0000 (09:40 -0400)
src/mono/mono/mini/interp/interp.c
src/mono/mono/mini/mini-runtime.c

index 8005a99..eff4a4e 100644 (file)
@@ -2925,7 +2925,11 @@ interp_create_method_pointer (MonoMethod *method, gboolean compile, MonoError *e
                 * the native caller expects a function pointer with the
                 * right signature, so fail right away.
                 */
-               mono_error_set_platform_not_supported (error, "No native to managed transitions on this platform.");
+               char *s = mono_method_get_full_name (orig_method);
+               char *msg = g_strdup_printf ("No native to managed transition for method '%s', missing [UnmanagedCallersOnly] attribute.", s);
+               mono_error_set_platform_not_supported (error, msg);
+               g_free (s);
+               g_free (msg);
                return NULL;
        }
 #endif
index bea43f2..d9bfd56 100644 (file)
@@ -2503,6 +2503,7 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, gboolean jit_
                code = mini_get_interp_callbacks ()->create_method_pointer (method, TRUE, error);
                if (code)
                        return code;
+               return_val_if_nok (error, NULL);
        }
 
        if (mono_llvm_only)