From: Aleksey Kliger Date: Fri, 27 May 2016 19:38:15 +0000 (-0400) Subject: [runtime] Avoid mono_error_raise_exception in icalls and debugging utilities X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=c18f296c9b57afef770a75f281c22ca8166fa0bf;p=mono.git [runtime] Avoid mono_error_raise_exception in icalls and debugging utilities --- diff --git a/mono/metadata/debug-helpers.c b/mono/metadata/debug-helpers.c index 9e933a64bb4..449895a5610 100644 --- a/mono/metadata/debug-helpers.c +++ b/mono/metadata/debug-helpers.c @@ -928,14 +928,18 @@ mono_object_describe (MonoObject *obj) klass = mono_object_class (obj); if (klass == mono_defaults.string_class) { char *utf8 = mono_string_to_utf8_checked ((MonoString*)obj, &error); - mono_error_raise_exception (&error); /* FIXME don't raise here */ - if (strlen (utf8) > 60) { + mono_error_cleanup (&error); /* FIXME don't swallow the error */ + if (utf8 && strlen (utf8) > 60) { utf8 [57] = '.'; utf8 [58] = '.'; utf8 [59] = '.'; utf8 [60] = 0; } - g_print ("String at %p, length: %d, '%s'\n", obj, mono_string_length ((MonoString*) obj), utf8); + if (utf8) { + g_print ("String at %p, length: %d, '%s'\n", obj, mono_string_length ((MonoString*) obj), utf8); + } else { + g_print ("String at %p, length: %d, unable to decode UTF16\n", obj, mono_string_length ((MonoString*) obj)); + } g_free (utf8); } else if (klass->rank) { MonoArray *array = (MonoArray*)obj; diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c index e8ab22e843b..5f9cabfc9e8 100644 --- a/mono/metadata/icall.c +++ b/mono/metadata/icall.c @@ -7549,6 +7549,7 @@ ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void) return mcpath; } +/* this is an icall */ static MonoString * get_bundled_app_config (void) { @@ -7567,7 +7568,8 @@ get_bundled_app_config (void) // Retrieve config file and remove the extension config_file_name = mono_string_to_utf8_checked (file, &error); - mono_error_raise_exception (&error); /* FIXME don't raise here */ + if (mono_error_set_pending_exception (&error)) + return NULL; config_file_path = mono_portability_find_file (config_file_name, TRUE); if (!config_file_path) config_file_path = config_file_name;