[MonoError] Don't overwrite computed TypeLoadException message with empty string
authorAleksey Kliger <aleksey@xamarin.com>
Mon, 26 Sep 2016 20:07:48 +0000 (16:07 -0400)
committerAleksey Kliger (λgeek) <akliger@gmail.com>
Tue, 4 Oct 2016 21:24:05 +0000 (17:24 -0400)
Fixes [#44729](https://bugzilla.xamarin.com/show_bug.cgi?id=44729).

mono/metadata/icall.c
mono/utils/mono-error.c

index 27bafb33291f7151a889412b11f11102bf7f4883..bab8c6235f0fc9e7186d8f6f8b509567b1525d60 100644 (file)
@@ -1420,7 +1420,7 @@ ves_icall_System_Type_internal_from_name (MonoString *name,
 
        if (type == NULL){
                if (throwOnError) {
-                       mono_error_set_type_load_name (&error, g_strdup (str), NULL, "");
+                       mono_error_set_type_load_name (&error, g_strdup (str), g_strdup (""), "");
                        goto leave;
                }
        }
index 7e186b6b717ce06b2f4103bb2ab3abe22e5ce2df..5ef98e1e9ef8047b95f38c555a8519b19ffd8bf3 100644 (file)
@@ -618,7 +618,7 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out)
                        }
 
                        exception = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", "TypeLoadException", type_name, assembly_name, error_out);
-                       if (exception)
+                       if (exception && error->full_message != NULL && strcmp (error->full_message, ""))
                                set_message_on_exception (exception, error, error_out);
                } else {
                        exception = mono_exception_from_name_msg (mono_defaults.corlib, "System", "TypeLoadException", error->full_message);