[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void basic_init (AssemblyBuilder ab);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern void UpdateNativeCustomAttributes (AssemblyBuilder ab);
+
/* Keep this in sync with codegen.cs in mcs */
private const AssemblyBuilderAccess COMPILER_ACCESS = (AssemblyBuilderAccess) 0x800;
internal void AddPermissionRequests (PermissionSet required, PermissionSet optional, PermissionSet refused)
{
-#if !NET_2_1
+#if !MOBILE
if (created)
throw new InvalidOperationException ("Assembly was already saved.");
return new AssemblyBuilder (name, null, access, false);
}
+ public static AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, IEnumerable<CustomAttributeBuilder> assemblyAttributes)
+ {
+ var ab = DefineDynamicAssembly (name, access);
+ foreach (var attr in assemblyAttributes) {
+ ab.SetCustomAttribute (attr);
+ }
+
+ return ab;
+ }
+
public ModuleBuilder DefineDynamicModule (string name)
{
return DefineDynamicModule (name, name, false, true);
cattrs = new CustomAttributeBuilder [1];
cattrs [0] = customBuilder;
}
+
+ /*
+ Only update the native list of custom attributes if we're adding one that is known to change dynamic execution behavior.
+ */
+ if (customBuilder.Ctor != null && customBuilder.Ctor.DeclaringType == typeof (System.Runtime.CompilerServices.RuntimeCompatibilityAttribute))
+ UpdateNativeCustomAttributes (this);
}
[ComVisible (true)]
/*Warning, @typeArguments must be a mscorlib internal array. So make a copy before passing it in*/
internal Type MakeGenericType (Type gtd, Type[] typeArguments)
{
- return new MonoGenericClass (gtd, typeArguments);
+ return new TypeBuilderInstantiation (gtd, typeArguments);
}
void _AssemblyBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)