X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fappdomain.c;h=93169cda59d4ba1ac7fb1a526b6a1b9a352bd489;hb=56ad8f4e5dfb8198e4671f631a3103b1e8b83dd3;hp=e5ecbacc8c8b5db3743d65481bcb09e553d06a9d;hpb=1f34699221d2b08cf6c4e648505d3cce227d2500;p=mono.git diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c index e5ecbacc8c8..93169cda59d 100644 --- a/mono/metadata/appdomain.c +++ b/mono/metadata/appdomain.c @@ -9,6 +9,7 @@ * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com) * Copyright 2004-2009 Novell, Inc (http://www.novell.com) * Copyright 2012 Xamarin Inc + * Licensed under the MIT license. See LICENSE file in the project root for full license information. */ #undef ASSEMBLY_LOAD_DEBUG #include @@ -257,7 +258,6 @@ mono_runtime_init_checked (MonoDomain *domain, MonoThreadStartCB start_cb, MonoT mono_install_assembly_postload_search_hook ((MonoAssemblySearchFunc)mono_domain_assembly_postload_search, GUINT_TO_POINTER (FALSE)); mono_install_assembly_postload_refonly_search_hook ((MonoAssemblySearchFunc)mono_domain_assembly_postload_search, GUINT_TO_POINTER (TRUE)); mono_install_assembly_load_hook (mono_domain_fire_assembly_load, NULL); - mono_install_lookup_dynamic_token (mono_reflection_lookup_dynamic_token); mono_thread_init (start_cb, attach_cb); @@ -307,6 +307,7 @@ mono_runtime_init_checked (MonoDomain *domain, MonoThreadStartCB start_cb, MonoT static int mono_get_corlib_version (void) { + MonoError error; MonoClass *klass; MonoClassField *field; MonoObject *value; @@ -318,7 +319,8 @@ mono_get_corlib_version (void) return -1; if (! (field->type->attrs & FIELD_ATTRIBUTE_STATIC)) return -1; - value = mono_field_get_value_object (mono_domain_get (), field, NULL); + value = mono_field_get_value_object_checked (mono_domain_get (), field, NULL, &error); + mono_error_raise_exception (&error); /* FIXME don't raise here */ return *(gint32*)((gchar*)value + sizeof (MonoObject)); } @@ -1764,7 +1766,7 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror) if (!mono_error_ok (&error)) { mono_error_cleanup (&error); g_free (dir_name); - mono_error_set_generic_error (oerror, "System", "ExecutionEngineException", "Failed to create shadow copy (invalid characters in shadow directory name)."); + mono_error_set_execution_engine (oerror, "Failed to create shadow copy (invalid characters in shadow directory name)."); return NULL; } @@ -1779,13 +1781,13 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror) shadow = get_shadow_assembly_location (filename, &error); if (!mono_error_ok (&error)) { mono_error_cleanup (&error); - mono_error_set_generic_error (oerror, "System", "ExecutionEngineException", "Failed to create shadow copy (invalid characters in file name)."); + mono_error_set_execution_engine (oerror, "Failed to create shadow copy (invalid characters in file name)."); return NULL; } if (ensure_directory_exists (shadow) == FALSE) { g_free (shadow); - mono_error_set_generic_error (oerror, "System", "ExecutionEngineException", "Failed to create shadow copy (ensure directory exists)."); + mono_error_set_execution_engine (oerror, "Failed to create shadow copy (ensure directory exists)."); return NULL; } @@ -1822,7 +1824,7 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror) if (GetLastError() == ERROR_FILE_NOT_FOUND || GetLastError() == ERROR_PATH_NOT_FOUND) return NULL; /* file not found, shadow copy failed */ - mono_error_set_generic_error (oerror, "System", "ExecutionEngineException", "Failed to create shadow copy (CopyFile)."); + mono_error_set_execution_engine (oerror, "Failed to create shadow copy (CopyFile)."); return NULL; } @@ -1841,14 +1843,14 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror) if (copy_result == FALSE) { g_free (shadow); - mono_error_set_generic_error (oerror, "System", "ExecutionEngineException", "Failed to create shadow copy of sibling data (CopyFile)."); + mono_error_set_execution_engine (oerror, "Failed to create shadow copy of sibling data (CopyFile)."); return NULL; } /* Create a .ini file containing the original assembly location */ if (!shadow_copy_create_ini (shadow, filename)) { g_free (shadow); - mono_error_set_generic_error (oerror, "System", "ExecutionEngineException", "Failed to create shadow copy .ini file."); + mono_error_set_execution_engine (oerror, "Failed to create shadow copy .ini file."); return NULL; } @@ -2144,10 +2146,11 @@ ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad, MonoString *assRef, void ves_icall_System_AppDomain_InternalUnload (gint32 domain_id) { + MonoException *exc = NULL; MonoDomain * domain = mono_domain_get_by_id (domain_id); if (NULL == domain) { - MonoException *exc = mono_get_exception_execution_engine ("Failed to unload domain, domain id not found"); + mono_get_exception_execution_engine ("Failed to unload domain, domain id not found"); mono_set_pending_exception (exc); return; } @@ -2167,7 +2170,9 @@ ves_icall_System_AppDomain_InternalUnload (gint32 domain_id) return; #endif - mono_domain_unload (domain); + mono_domain_try_unload (domain, (MonoObject**)&exc); + if (exc) + mono_set_pending_exception (exc); } gboolean @@ -2514,8 +2519,6 @@ mono_domain_unload (MonoDomain *domain) { MonoObject *exc = NULL; mono_domain_try_unload (domain, &exc); - if (exc) - mono_raise_exception ((MonoException*)exc); } static guint32