internal AssemblyBuilder(AppDomain domain, AssemblyName name, AssemblyBuilderAccess access, ref StackCrawlMark stackMark, IEnumerable <CustomAttributeBuilder> unsafeAssemblyAttributes) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (access != AssemblyBuilderAccess.Run && access != AssemblyBuilderAccess.RunAndCollect) { throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)access), nameof(access)); } // Clone the name in case the caller modifies it underneath us. name = (AssemblyName)name.Clone(); // Scan the assembly level attributes for any attributes which modify how we create the // assembly. Currently, we look for any attribute which modifies the security transparency // of the assembly. List <CustomAttributeBuilder> assemblyAttributes = null; if (unsafeAssemblyAttributes != null) { // Create a copy to ensure that it cannot be modified from another thread // as it is used further below. assemblyAttributes = new List <CustomAttributeBuilder>(unsafeAssemblyAttributes); } _internalAssemblyBuilder = (InternalAssemblyBuilder)nCreateDynamicAssembly(domain, name, ref stackMark, access); _assemblyData = new AssemblyBuilderData(_internalAssemblyBuilder, access); // Make sure that ManifestModule is properly initialized // We need to do this before setting any CustomAttribute InitManifestModule(); if (assemblyAttributes != null) { foreach (CustomAttributeBuilder assemblyAttribute in assemblyAttributes) { SetCustomAttribute(assemblyAttribute); } } }
public PhotonMapperBuilder(string assemblyName, string fileName, string namespacePrefix) { _assemblyBuilder = new InternalAssemblyBuilder(assemblyName, fileName, namespacePrefix); }
public PhotonMapperBuilder() { _assemblyBuilder = new InternalAssemblyBuilder(Guid.NewGuid().ToString()); }