Skip to content

Commit

Permalink
Don't assume presence of MonoResolveUnmanagedDllUsingEvent method (#4…
Browse files Browse the repository at this point in the history
…6917)

Follow up change missing in #46323

Fixes #46908
  • Loading branch information
marek-safar authored Jan 13, 2021
1 parent 5b99a39 commit ed7d2fb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/mono/mono/metadata/native-library.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,13 +699,18 @@ netcore_resolve_with_resolving_event (MonoAssemblyLoadContext *alc, MonoAssembly
MONO_STATIC_POINTER_INIT (MonoMethod, resolve)

ERROR_DECL (local_error);
MonoClass *alc_class = mono_class_get_assembly_load_context_class ();
g_assert (alc_class);
resolve = mono_class_get_method_from_name_checked (alc_class, "MonoResolveUnmanagedDllUsingEvent", -1, 0, local_error);
mono_error_assert_ok (local_error);
static gboolean inited;
if (!inited) {
MonoClass *alc_class = mono_class_get_assembly_load_context_class ();
g_assert (alc_class);
resolve = mono_class_get_method_from_name_checked (alc_class, "MonoResolveUnmanagedDllUsingEvent", -1, 0, local_error);
inited = TRUE;
}
mono_error_cleanup (local_error);

MONO_STATIC_POINTER_INIT_END (MonoMethod, resolve)
g_assert (resolve);
if (!resolve)
return NULL;

if (mono_runtime_get_no_exec ())
return NULL;
Expand Down

0 comments on commit ed7d2fb

Please sign in to comment.