From 6d175d23424e5cb4a8356641b823defe206dcf52 Mon Sep 17 00:00:00 2001 From: Ryan Lucia Date: Wed, 8 Jan 2020 15:57:16 -0500 Subject: [PATCH] [metadata] Propagate error in mono_runtime_try_invoke_array (mono/mono#18382) This was prompted by https://github.com/mono/mono/issues/18339, which seems to be failing to locate a native library and then hitting an assertion. We should propagate the error instead, so that if others run into something similar they can see what's actually going wrong instead of just getting a runtime crash. Commit migrated from https://github.com/mono/mono/commit/1178ab3a1a48dbc831ecd905a7d88bfd417e0d73 --- src/mono/mono/metadata/object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/metadata/object.c b/src/mono/mono/metadata/object.c index 02d1a8e..32b0862 100644 --- a/src/mono/mono/metadata/object.c +++ b/src/mono/mono/metadata/object.c @@ -5576,7 +5576,7 @@ mono_runtime_try_invoke_array (MonoMethod *method, void *obj, MonoArray *params, if (!obj) { obj = mono_object_new_checked (mono_domain_get (), method->klass, error); - mono_error_assert_ok (error); + return_val_if_nok (error, NULL); g_assert (obj); /*maybe we should raise a TLE instead?*/ #ifndef DISABLE_REMOTING if (mono_object_is_transparent_proxy (obj)) { -- 2.7.4