From 215f7744f62a340c4d31f94f6aa0d43ae8326764 Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Tue, 22 May 2012 12:57:47 -0300 Subject: [PATCH] Replace some g_assert with g_error. --- mono/metadata/object.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/mono/metadata/object.c b/mono/metadata/object.c index 9b7251f0c58..823b47d7b84 100644 --- a/mono/metadata/object.c +++ b/mono/metadata/object.c @@ -96,7 +96,8 @@ mono_runtime_object_init (MonoObject *this) MonoClass *klass = this->vtable->klass; method = mono_class_get_method_from_name (klass, ".ctor", 0); - g_assert (method); + if (!method) + g_error ("Could not lookup zero argument constructor for class %s", mono_type_get_full_name (klass)); if (method->klass->valuetype) this = mono_object_unbox (this); @@ -219,8 +220,9 @@ get_type_init_exception_for_vtable (MonoVTable *vtable) MonoException *ex; gchar *full_name; - g_assert (vtable->init_failed); - + if (!vtable->init_failed) + g_error ("Trying to get the init exception for a non-failed vtable of class %s", mono_type_get_full_name (klass)); + /* * If the initializing thread was rudely aborted, the exception is not stored * in the hash. @@ -1067,9 +1069,8 @@ mono_method_get_imt_slot (MonoMethod *method) hashes = hashes_start; if (! MONO_CLASS_IS_INTERFACE (method->klass)) { - printf ("mono_method_get_imt_slot: %s.%s.%s is not an interface MonoMethod\n", + g_error ("mono_method_get_imt_slot: %s.%s.%s is not an interface MonoMethod", method->klass->name_space, method->klass->name, method->name); - g_assert_not_reached (); } /* Initialize hashes */ @@ -2935,8 +2936,7 @@ handle_enum: t = type->data.generic_class->container_class->byval_arg.type; goto handle_enum; default: - g_warning ("got type %x", type->type); - g_assert_not_reached (); + g_error ("got type %x", type->type); } } @@ -3442,9 +3442,11 @@ MonoObject* mono_runtime_delegate_invoke (MonoObject *delegate, void **params, MonoObject **exc) { MonoMethod *im; + MonoClass *klass = delegate->vtable->klass; - im = mono_get_delegate_invoke (delegate->vtable->klass); - g_assert (im); + im = mono_get_delegate_invoke (klass); + if (!im) + g_error ("Could not lookup delegate invoke method for delegate %s", mono_type_get_full_name (klass)); return mono_runtime_invoke (im, delegate, params, exc); } -- 2.11.4.GIT