2007-07-22 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / metadata / appdomain.c
index 457ab312ae8521797f3fa3a9778a60bbe4b775a0..020a47cc97be23da621f02b5ea9e8539d36e3558 100644 (file)
@@ -12,7 +12,9 @@
 #include <config.h>
 #include <glib.h>
 #include <string.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -41,7 +43,7 @@
 #include <direct.h>
 #endif
 
-#define MONO_CORLIB_VERSION 54
+#define MONO_CORLIB_VERSION 58
 
 CRITICAL_SECTION mono_delegate_section;
 
@@ -633,9 +635,10 @@ add_assemblies_to_domain (MonoDomain *domain, MonoAssembly *ass, GHashTable *ht)
 
        if (ass->image->references) {
                for (i = 0; ass->image->references [i] != NULL; i++) {
-                       if (!g_hash_table_lookup (ht, ass->image->references [i])) {
-                               add_assemblies_to_domain (domain, ass->image->references [i], ht);
-                       }
+                       if (ass->image->references [i] != REFERENCE_MISSING)
+                               if (!g_hash_table_lookup (ht, ass->image->references [i])) {
+                                       add_assemblies_to_domain (domain, ass->image->references [i], ht);
+                               }
                }
        }
        if (destroy_ht)
@@ -847,15 +850,16 @@ static char *
 get_shadow_assembly_location (const char *filename)
 {
        gint32 hash = 0, hash2 = 0;
+       guint32 ticks = GetTickCount ();
        char name_hash [9];
-       char path_hash [19];
+       char path_hash [30];
        char *bname = g_path_get_basename (filename);
        MonoDomain *domain = mono_domain_get ();
        
        hash = get_cstring_hash (bname);
        hash2 = get_cstring_hash (g_path_get_dirname (filename));
        g_snprintf (name_hash, sizeof (name_hash), "%08x", hash);
-       g_snprintf (path_hash, sizeof (path_hash), "%08x_%08x", hash ^ hash2, hash2);
+       g_snprintf (path_hash, sizeof (path_hash), "%08x_%08x_%08x", hash ^ hash2, hash2, ticks);
        return g_build_filename (mono_string_to_utf8 (domain->setup->dynamic_base), 
                                 "assembly", 
                                 "shadow", 
@@ -1163,9 +1167,9 @@ ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname, MonoBoolean re
 
 MonoReflectionAssembly *
 ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomain *ad, 
-                                                                                       MonoArray *raw_assembly,
-                                                                                       MonoArray *raw_symbol_store, MonoObject *evidence,
-                                                                                       MonoBoolean refonly)
+                                           MonoArray *raw_assembly,
+                                           MonoArray *raw_symbol_store, MonoObject *evidence,
+                                           MonoBoolean refonly)
 {
        MonoAssembly *ass;
        MonoReflectionAssembly *refass = NULL;