Revert until Martin is online to debug
[mono.git] / mono / metadata / appdomain.c
index 3ac821d6999240d42ed8059a08c7764d3f7eea24..6e2e54a3f6e0cbf13de6fb6ab7c4f7987f7fdcd8 100644 (file)
@@ -31,7 +31,7 @@
 #include <mono/utils/mono-uri.h>
 #include <mono/utils/mono-logger.h>
 
-#define MONO_CORLIB_VERSION 50
+#define MONO_CORLIB_VERSION 53
 
 CRITICAL_SECTION mono_delegate_section;
 
@@ -201,6 +201,8 @@ mono_runtime_cleanup (MonoDomain *domain)
        /* This ends up calling any pending pending (for at most 2 seconds) */
        mono_gc_cleanup ();
 
+       mono_thread_cleanup ();
+
        mono_network_cleanup ();
 
        mono_marshal_cleanup ();
@@ -976,13 +978,19 @@ ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname, MonoBoolean re
 
        ass = mono_assembly_open_full (filename, &status, refOnly);
        
-       g_free (name);
-
        if (!ass){
-               MonoException *exc = mono_get_exception_file_not_found (fname);
+               MonoException *exc;
+
+               if (status == MONO_IMAGE_IMAGE_INVALID)
+                       exc = mono_get_exception_bad_image_format (name);
+               else
+                       exc = mono_get_exception_file_not_found (fname);
+               g_free (name);
                mono_raise_exception (exc);
        }
 
+       g_free (name);
+
        return mono_assembly_get_object (domain, ass);
 }