2004-05-11 Zoltan Varga <vargaz@freemail.hu>
authorZoltan Varga <vargaz@gmail.com>
Tue, 11 May 2004 11:48:31 +0000 (11:48 -0000)
committerZoltan Varga <vargaz@gmail.com>
Tue, 11 May 2004 11:48:31 +0000 (11:48 -0000)
* reflection.c (mono_reflection_get_type): Lookup the type in all
modules of a multi-module assembly. Fixes #58291.

svn path=/trunk/mono/; revision=27091

mono/metadata/ChangeLog
mono/metadata/reflection.c

index ae600c868da0b3fc19322336bac36ff56d2a9cf1..7ae9437c8248124b2deb83c15423a7700be13d4a 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-11  Zoltan Varga  <vargaz@freemail.hu>
+
+       * reflection.c (mono_reflection_get_type): Lookup the type in all
+       modules of a multi-module assembly. Fixes #58291.
+
 2004-05-11  Lluis Sanchez Gual  <lluis@ximian.com>
 
        * threads.c: Before aborting a background, set the StopRequested state (this
index 054e956645a42d3458bd0cafbf1519935de40d76..d7c958f1bd2442d782558548316f59bfe94b7882 100644 (file)
@@ -5477,9 +5477,36 @@ mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ig
        assembly = 
                mono_domain_try_type_resolve (
                        mono_domain_get (), fullName->str, NULL);
-       if (assembly && (!image || (assembly->assembly->image == image)))
-               type = mono_reflection_get_type_internal (assembly->assembly->image, 
-                                                                                info, ignorecase);
+       if (assembly && (!image || (assembly->assembly->image == image))) {
+
+               if (assembly->assembly->dynamic) {
+                       /* Enumerate all modules */
+                       MonoReflectionAssemblyBuilder *abuilder = (MonoReflectionAssemblyBuilder*)assembly;
+                       int i;
+
+                       type = NULL;
+                       if (abuilder->modules) {
+                               for (i = 0; i < mono_array_length (abuilder->modules); ++i) {
+                                       MonoReflectionModuleBuilder *mb = mono_array_get (abuilder->modules, MonoReflectionModuleBuilder*, i);
+                                       type = mono_reflection_get_type_internal (&mb->dynamic_image->image, info, ignorecase);
+                                       if (type)
+                                               break;
+                               }
+                       }
+
+                       if (!type && abuilder->loaded_modules) {
+                               for (i = 0; i < mono_array_length (abuilder->loaded_modules); ++i) {
+                                       MonoReflectionModule *mod = mono_array_get (abuilder->loaded_modules, MonoReflectionModule*, i);
+                                       type = mono_reflection_get_type_internal (mod->image, info, ignorecase);
+                                       if (type)
+                                               break;
+                               }
+                       }
+               }
+               else
+                       type = mono_reflection_get_type_internal (assembly->assembly->image, 
+                                                                                                         info, ignorecase);
+       }
        g_string_free (fullName, TRUE);
        return type;
 }