klass = my_mono_class_from_mono_type (type);
ta = klass->image->assembly;
- /* missing public key */
- result = g_strdup_printf ("%s, %s, Version=%d.%d.%d.%d, Culture=%s",
+ result = g_strdup_printf ("%s, %s, Version=%d.%d.%d.%d, Culture=%s, PublicKeyToken=%s",
name, ta->aname.name,
ta->aname.major, ta->aname.minor, ta->aname.build, ta->aname.revision,
- ta->aname.culture && *ta->aname.culture? ta->aname.culture: "neutral");
+ ta->aname.culture && *ta->aname.culture? ta->aname.culture: "neutral",
+ ta->aname.public_tok_value ? ta->aname.public_tok_value : "null");
g_free (name);
return result;
}
mono_metadata_encode_value (minfo->type, p, &p);
mono_metadata_encode_value (minfo->count, p, &p);
break;
- /* FIXME: handle ARRAY and other unmanaged types that need extra info */
+ case MONO_NATIVE_LPARRAY:
+ mono_metadata_encode_value (minfo->type, p, &p);
+ if (minfo->eltype || (minfo->count > 0)) {
+ mono_metadata_encode_value (minfo->eltype, p, &p);
+ if (minfo->count > 0) {
+ mono_metadata_encode_value (0, p, &p);
+ mono_metadata_encode_value (minfo->count, p, &p);
+ }
+ }
+ break;
case MONO_NATIVE_CUSTOM:
mono_metadata_encode_value (minfo->type, p, &p);
if (minfo->guid) {
param = gparam->type.type->data.generic_param;
values [MONO_GENERICPARAM_OWNER] = owner;
- values [MONO_GENERICPARAM_FLAGS] = param->flags;
+ if (gparam->has_value_type)
+ values [MONO_GENERICPARAM_FLAGS] = 0x18;
+ else if (gparam->has_reference_type)
+ values [MONO_GENERICPARAM_FLAGS] = 0x04;
+ else
+ values [MONO_GENERICPARAM_FLAGS] = 0x00;
values [MONO_GENERICPARAM_NUMBER] = param->num;
values [MONO_GENERICPARAM_NAME] = string_heap_insert (&assembly->sheap, param->name);
values [MONO_GENERICPARAM_KIND] = 0;
table->rows ++;
alloc_table (table, table->rows);
values = table->values + token * MONO_ASSEMBLYREF_SIZE;
- if (strcmp ("corlib", image->assembly_name) == 0)
- values [MONO_ASSEMBLYREF_NAME] = string_heap_insert (&assembly->sheap, "mscorlib");
- else
- values [MONO_ASSEMBLYREF_NAME] = string_heap_insert (&assembly->sheap, image->assembly_name);
+ values [MONO_ASSEMBLYREF_NAME] = string_heap_insert (&assembly->sheap, image->assembly_name);
values [MONO_ASSEMBLYREF_MAJOR_VERSION] = cols [MONO_ASSEMBLY_MAJOR_VERSION];
values [MONO_ASSEMBLYREF_MINOR_VERSION] = cols [MONO_ASSEMBLY_MINOR_VERSION];
values [MONO_ASSEMBLYREF_BUILD_NUMBER] = cols [MONO_ASSEMBLY_BUILD_NUMBER];
* recognized by ms, yuck!
* FIXME: need to add more assembly names, as needed.
*/
- if (strcmp (image->assembly_name, "corlib") == 0 ||
- strcmp (image->assembly_name, "mscorlib") == 0 ||
+ if (strcmp (image->assembly_name, "mscorlib") == 0 ||
strcmp (image->assembly_name, "System") == 0 ||
strcmp (image->assembly_name, "System.Runtime.Remoting") == 0 ||
strcmp (image->assembly_name, "System.Xml") == 0 ||
memset (assembly, 0, sizeof (MonoAssemblyName));
assembly->name = p;
assembly->culture = "";
-
+ assembly->public_tok_value = NULL;
+
while (*p && (isalnum (*p) || *p == '.' || *p == '-' || *p == '_' || *p == '$' || *p == '@'))
p++;
found_sep = 0;
if (!found_sep)
return 1;
while (*p) {
- if (*p == 'V' && strncmp (p, "Version=", 8) == 0) {
+ if (*p == 'V' && g_ascii_strncasecmp (p, "Version=", 8) == 0) {
p += 8;
assembly->major = strtoul (p, &s, 10);
if (s == p || *s != '.')
assembly->revision = strtoul (p, &s, 10);
if (s == p)
return 1;
- } else if (*p == 'C' && strncmp (p, "Culture=", 8) == 0) {
+ p = s;
+ } else if (*p == 'C' && g_ascii_strncasecmp (p, "Culture=", 8) == 0) {
p += 8;
- if (strncmp (p, "neutral", 7) == 0) {
- assembly->culture = "";
+ if (g_ascii_strncasecmp (p, "neutral", 7) == 0) {
+ assembly->culture = g_strdup ("");
p += 7;
} else {
assembly->culture = p;
p++;
}
}
- } else if (*p == 'P' && strncmp (p, "PublicKeyToken=", 15) == 0) {
+ } else if (*p == 'P' && g_ascii_strncasecmp (p, "PublicKeyToken=", 15) == 0) {
p += 15;
- s = p;
- while (*s && isxdigit (*s)) {
- *s = tolower (*s);
- s++;
- }
- assembly->hash_len = s - p;
- if (!(s-p) || ((s-p) & 1))
- return 1;
- assembly->hash_value = s = p;
- while (*s && isxdigit (*s)) {
- int val;
- val = *s >= '0' && *s <= '9'? *s - '0': *s - 'a' + 10;
- s++;
- *p = val << 4;
- *p |= *s >= '0' && *s <= '9'? *s - '0': *s - 'a' + 10;
- p++;
+ if (strncmp (p, "null", 4) == 0) {
+ p += 4;
+ } else {
+ assembly->public_tok_value = p;
+ while (*p && *p != ',') {
+ p++;
+ }
}
- p = s;
} else {
while (*p && *p != ',')
p++;
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;
}
image = &gparam->tbuilder->module->dynamic_image->image;
mono_class_from_generic_parameter (param, image, gparam->mbuilder != NULL);
+ param->pklass->reflection_info = gparam;
+
gparam->type.type = g_new0 (MonoType, 1);
gparam->type.type->type = gparam->mbuilder ? MONO_TYPE_MVAR : MONO_TYPE_VAR;
+ gparam->type.type->attrs = TYPE_ATTRIBUTE_PUBLIC;
gparam->type.type->data.generic_param = param;
}