From aa07d1c2d5bd2e70c7139c6ce11ee9f38ca56983 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Fri, 14 Jul 2017 12:58:08 -0400 Subject: [PATCH] [pedump] Print failure cause message when a class cannot be initialized --- tools/pedump/pedump.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/pedump/pedump.c b/tools/pedump/pedump.c index 5b76dfd19bd..322185faaf7 100644 --- a/tools/pedump/pedump.c +++ b/tools/pedump/pedump.c @@ -488,13 +488,21 @@ verify_image_file (const char *fname) } mono_class_init (klass); if (mono_class_has_failure (klass)) { - printf ("Error verifying class(0x%08x) %s.%s a type load error happened\n", token, klass->name_space, klass->name); + MonoError type_load_error; + error_init (&type_load_error); + mono_error_set_for_class_failure (&type_load_error, klass); + printf ("Could not initialize class(0x%08x) %s.%s due to %s\n", token, klass->name_space, klass->name, mono_error_get_message (&type_load_error)); + mono_error_cleanup (&type_load_error); ++count; } mono_class_setup_vtable (klass); if (mono_class_has_failure (klass)) { - printf ("Error verifying class(0x%08x) %s.%s a type load error happened\n", token, klass->name_space, klass->name); + MonoError type_load_error; + error_init (&type_load_error); + mono_error_set_for_class_failure (&type_load_error, klass); + printf ("Could not initialize vtable of class(0x%08x) %s.%s due to %s\n", token, klass->name_space, klass->name, mono_error_get_message (&type_load_error)); + mono_error_cleanup (&type_load_error); ++count; } } -- 2.25.1