diff options
Diffstat (limited to 'mcs/class/corlib/System.Reflection.Emit')
5 files changed, 63 insertions, 5 deletions
diff --git a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs index ebe86410469..344395be1a3 100755 --- a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs @@ -131,8 +131,16 @@ namespace System.Reflection.Emit { } if (n.KeyPair != null) { + // full keypair is available (for signing) sn = n.KeyPair.StrongName (); } + else { + // public key is available (for delay-signing) + byte[] pk = n.GetPublicKey (); + if ((pk != null) && (pk.Length > 0)) { + sn = new Mono.Security.StrongName (pk); + } + } basic_init (this); } diff --git a/mcs/class/corlib/System.Reflection.Emit/ChangeLog b/mcs/class/corlib/System.Reflection.Emit/ChangeLog index 5aeec6cdae4..0ecc28b55ff 100644 --- a/mcs/class/corlib/System.Reflection.Emit/ChangeLog +++ b/mcs/class/corlib/System.Reflection.Emit/ChangeLog @@ -1,3 +1,33 @@ +2004-10-06 Zoltan Varga <vargaz@freemail.hu> + + * ModuleBuilder.cs (GetTypes): Fix length of returned array. Fixes + #65931. + +2004-10-04 Zoltan Varga <vargaz@freemail.hu> + + * ModuleBuilder.cs (DefineType): Check for duplicate type names. Fixes + #65988. + +2004-09-17 Zoltan Varga <vargaz@freemail.hu> + + * CustomAttributeBuilder.cs: Applied patch from Marcus Urban (mathpup@mylinuxisp.com). Add support for defining custom marshallers by calling SetCustomAttribute. + +2004-09-09 Zoltan Varga <vargaz@freemail.hu> + + * TypeBuilder.cs: Set the table_idx of the global type to 1. + + * ModuleBuilder.cs: Save the main module of the assembly even if it is + transient. + +2004-08-13 Sebastien Pouliot <sebastien@ximian.com> + + * AssemblyBuilder.cs: (Partly) Fix delay-signing issue (#56621) when + MCS is used on the MS runtime (other part of the fix is for MCS). + +2004-07-24 Martin Baulig <martin@ximian.com> + + * TypeBuilder.cs (TypeBuilder.UnspecifiedTypeSize): Set this to 0 + and initialize it to 0 everywhere. Thu Jun 24 15:33:04 CEST 2004 Paolo Molaro <lupus@ximian.com> diff --git a/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs index e85e67022bc..daadb065ed3 100755 --- a/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs @@ -198,6 +198,8 @@ namespace System.Reflection.Emit { int sizeConst = 0; int value; int utype; /* the (stupid) ctor takes a short or an enum ... */ + Type marshalTypeRef = null; + string marshalCookie = String.Empty; utype = (int)data [2]; utype |= ((int)data [3]) << 8; @@ -231,7 +233,21 @@ namespace System.Reflection.Emit { value |= ((int)data [pos++]) << 24; sizeConst = value; break; + case "MarshalTypeRef": + case "MarshalType": + len = decode_len (data, pos, out pos); + marshalTypeRef = Type.GetType (string_from_bytes (data, pos, len)); + pos += len; + break; + case "MarshalCookie": + len = decode_len (data, pos, out pos); + marshalCookie = string_from_bytes (data, pos, len); + pos += len; + break; default: + len = decode_len(data, pos, out pos); + string v = string_from_bytes (data, pos, len); + pos += len; break; } } @@ -245,6 +261,8 @@ namespace System.Reflection.Emit { return UnmanagedMarshal.DefineByValArray (sizeConst); case UnmanagedType.ByValTStr: return UnmanagedMarshal.DefineByValTStr (sizeConst); + case UnmanagedType.CustomMarshaler: + return UnmanagedMarshal.DefineCustom ( marshalTypeRef, marshalCookie, marshalTypeRef.ToString (), Guid.Empty); default: return UnmanagedMarshal.DefineUnmanagedMarshal ((UnmanagedType)utype); } diff --git a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs index a7d4888d6d7..eabb8f84fb9 100644 --- a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs @@ -252,6 +252,8 @@ namespace System.Reflection.Emit { } private TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, Type[] interfaces, PackingSize packsize, int typesize) { + if (name_cache.Contains (name)) + throw new ArgumentException ("Duplicate type name within an assembly."); TypeBuilder res = new TypeBuilder (this, name, attr, parent, interfaces, packsize, typesize, null); if (types != null) { if (types.Length == num_types) { @@ -433,7 +435,7 @@ namespace System.Reflection.Emit { if (types == null) return new TypeBuilder [0]; - int n = types.Length; + int n = num_types; TypeBuilder [] copy = new TypeBuilder [n]; Array.Copy (types, copy, n); @@ -624,9 +626,8 @@ namespace System.Reflection.Emit { internal void Save () { - if (transient) + if (transient && !is_main) return; - if ((global_type != null) && (global_type_created == null)) global_type_created = global_type.CreateType (); diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs index 1f6884bdc12..edcf429d9cc 100644 --- a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs @@ -95,8 +95,9 @@ namespace System.Reflection.Emit { internal TypeBuilder (ModuleBuilder mb, TypeAttributes attr) { this.parent = null; this.attrs = attr; - this.class_size = -1; + this.class_size = 0; fullname = this.tname = "<Module>"; + this.table_idx = 1; this.nspace = ""; pmodule = mb; setup_internal_class (this); @@ -987,7 +988,7 @@ namespace System.Reflection.Emit { public override Type[] GetNestedTypes (BindingFlags bindingAttr) { bool match; ArrayList result = new ArrayList (); - + if (subtypes == null) return Type.EmptyTypes; foreach (TypeBuilder t in subtypes) { |