public sealed class AssemblyBuilder : Assembly
|
If a dynamic assembly contains more than one dynamic module, the assembly's manifest file name should match the module's name that is specified as the first argument to AssemblyBuilder.DefineDynamicModule.
Some methods on the base class Assembly such as GetModules and GetLoadedModules will not work correctly when called AssemblyBuilder objects. You can load the defined dynamic assembly and call the methods on the loaded assembly. For example, to ensure that resource modules are included in the returned module list, call GetModules on the loaded Assembly object.
The signing of a dynamic assembly using AssemblyName.KeyPair is not effective until the assembly is saved to disk. So, strong names will not work with transient dynamic assemblies.CodeBase | Read-only Overridden: Gets the location of the assembly, as specified originally (such as in an AssemblyName object). |
EntryPoint | Read-only Overridden: Returns the entry point of this assembly. |
EscapedCodeBase (inherited from System.Reflection.Assembly) |
Read-only See base class member description: System.Reflection.Assembly.EscapedCodeBase Gets the URI, including escape characters, that represents the codebase. |
Evidence (inherited from System.Reflection.Assembly) |
Read-only See base class member description: System.Reflection.Assembly.Evidence Gets the evidence for this assembly. |
FullName (inherited from System.Reflection.Assembly) |
Read-only See base class member description: System.Reflection.Assembly.FullName Gets the display name of the assembly. |
GlobalAssemblyCache (inherited from System.Reflection.Assembly) |
Read-only See base class member description: System.Reflection.Assembly.GlobalAssemblyCache Gets a value indicating whether the assembly was loaded from the global assembly cache. |
Location | Read-only Overridden: Gets the location, in codebase format, of the loaded file that contains the manifest if it is not shadow-copied. |
AddResourceFile | Overloaded:AddResourceFile(string name, string fileName) Adds an existing resource file to this assembly. |
AddResourceFile | Overloaded:AddResourceFile(string name, string fileName, ResourceAttributes attribute) Adds an existing resource file to this assembly. |
CreateInstance (inherited from System.Reflection.Assembly) |
Overloaded:CreateInstance(string typeName) See base class member description: System.Reflection.Assembly.CreateInstanceLocates the specified type from this assembly and creates an instance of it using the system activator, using case-sensitive search. |
CreateInstance (inherited from System.Reflection.Assembly) |
Overloaded:CreateInstance(string typeName, bool ignoreCase) See base class member description: System.Reflection.Assembly.CreateInstanceLocates the specified type from this assembly and creates an instance of it using the system activator, with optional case-sensitive search. |
CreateInstance (inherited from System.Reflection.Assembly) |
Overloaded:CreateInstance(string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes) See base class member description: System.Reflection.Assembly.CreateInstanceLocates the specified type from this assembly and creates an instance of it using the system activator, with optional case-sensitive search and having the specified culture, arguments, and binding and activation attributes. |
DefineDynamicModule | Overloaded:DefineDynamicModule(string name) Defines a named transient dynamic module in this assembly. |
DefineDynamicModule | Overloaded:DefineDynamicModule(string name, bool emitSymbolInfo) Defines a named transient dynamic module in this assembly and specifies whether symbol information should be emitted. |
DefineDynamicModule | Overloaded:DefineDynamicModule(string name, string fileName) Defines a dynamic module with the given name that will be saved to the specified file. No symbol information is emitted. |
DefineDynamicModule | Overloaded:DefineDynamicModule(string name, string fileName, bool emitSymbolInfo) Defines a persistable dynamic module in this dynamic assembly that includes symbolic information using the default symbol writer. |
DefineResource | Overloaded:DefineResource(string name, string description, string fileName) Defines a standalone managed resource for this assembly with the default public resource attribute. |
DefineResource | Overloaded:DefineResource(string name, string description, string fileName, ResourceAttributes attribute) Defines a standalone managed resource for this assembly. Attributes can be specified for the managed resource. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetCustomAttributes (inherited from System.Reflection.Assembly) |
Overloaded:GetCustomAttributes(bool inherit) See base class member description: System.Reflection.Assembly.GetCustomAttributesGets all the custom attributes for this assembly. |
GetCustomAttributes (inherited from System.Reflection.Assembly) |
Overloaded:GetCustomAttributes(Type attributeType, bool inherit) See base class member description: System.Reflection.Assembly.GetCustomAttributesGets the custom attributes for this assembly as specified by type. |
GetDynamicModule | Returns the dynamic module with the specified name. |
GetExportedTypes | Overridden: Gets the exported types defined in this assembly. |
GetFile | Overridden: Gets a FileStream for the specified file in the file table of the manifest of this assembly. |
GetFiles (inherited from System.Reflection.Assembly) |
Overloaded:GetFiles() See base class member description: System.Reflection.Assembly.GetFilesGets the files in the file table of an assembly manifest. |
GetFiles | Overloaded:GetFiles(bool getResourceModules) Overridden: Gets the files in the file table of an assembly manifest, specifying whether to include resource modules. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetLoadedModules (inherited from System.Reflection.Assembly) |
Overloaded:GetLoadedModules() See base class member description: System.Reflection.Assembly.GetLoadedModulesGets all the loaded modules that are part of this assembly. |
GetLoadedModules (inherited from System.Reflection.Assembly) |
Overloaded:GetLoadedModules(bool getResourceModules) See base class member description: System.Reflection.Assembly.GetLoadedModulesGets all the loaded modules that are part of this assembly, specifying whether to include resource modules. |
GetManifestResourceInfo | Overridden: Returns information about how the given resource has been persisted. |
GetManifestResourceNames | Overridden: Loads the specified manifest resource from this assembly. |
GetManifestResourceStream | Overloaded:GetManifestResourceStream(string name) Overridden: Loads the specified manifest resource from this assembly. |
GetManifestResourceStream | Overloaded:GetManifestResourceStream(Type type, string name) Overridden: Loads the specified manifest resource, scoped by the namespace of the specified type, from this assembly. |
GetModule (inherited from System.Reflection.Assembly) |
See base class member description: System.Reflection.Assembly.GetModule Gets the specified module in this assembly. |
GetModules (inherited from System.Reflection.Assembly) |
Overloaded:GetModules() See base class member description: System.Reflection.Assembly.GetModulesGets all the modules that are part of this assembly. |
GetModules (inherited from System.Reflection.Assembly) |
Overloaded:GetModules(bool getResourceModules) See base class member description: System.Reflection.Assembly.GetModulesGets all the modules that are part of this assembly, specifying whether to include resource modules. |
GetName (inherited from System.Reflection.Assembly) |
Overloaded:GetName() See base class member description: System.Reflection.Assembly.GetNameGets an AssemblyName for this assembly. |
GetName (inherited from System.Reflection.Assembly) |
Overloaded:GetName(bool copiedName) See base class member description: System.Reflection.Assembly.GetNameGets an AssemblyName for this assembly, setting the codebase as specified by copiedName. |
GetObjectData (inherited from System.Reflection.Assembly) |
See base class member description: System.Reflection.Assembly.GetObjectData Gets serialization information with all of the data needed to reinstantiate this assembly. |
GetReferencedAssemblies (inherited from System.Reflection.Assembly) |
See base class member description: System.Reflection.Assembly.GetReferencedAssemblies Gets the AssemblyName objects for all the assemblies referenced by this assembly. |
GetSatelliteAssembly (inherited from System.Reflection.Assembly) |
Overloaded:GetSatelliteAssembly(CultureInfo culture) See base class member description: System.Reflection.Assembly.GetSatelliteAssemblyGets the satellite assembly for the specified culture. |
GetSatelliteAssembly (inherited from System.Reflection.Assembly) |
Overloaded:GetSatelliteAssembly(CultureInfo culture, Version version) See base class member description: System.Reflection.Assembly.GetSatelliteAssemblyGets the specified version of the satellite assembly for the specified culture. |
GetType (inherited from System.Object) |
Overloaded:GetType() See base class member description: System.Object.GetTypeDerived from System.Object, the primary base class for all objects. |
GetType (inherited from System.Reflection.Assembly) |
Overloaded:GetType(string name) See base class member description: System.Reflection.Assembly.GetTypeGets the Type object with the specified name in the assembly instance. |
GetType (inherited from System.Reflection.Assembly) |
Overloaded:GetType(string name, bool throwOnError) See base class member description: System.Reflection.Assembly.GetTypeGets the Type object with the specified name in the assembly instance and optionally throws an exception. |
GetType (inherited from System.Reflection.Assembly) |
Overloaded:GetType(string name, bool throwOnError, bool ignoreCase) See base class member description: System.Reflection.Assembly.GetTypeGets the Type object with the specified name in the assembly instance, with the options of ignoring the case, and throwing an exception. |
GetTypes (inherited from System.Reflection.Assembly) |
See base class member description: System.Reflection.Assembly.GetTypes Gets the types defined in this assembly. |
IsDefined (inherited from System.Reflection.Assembly) |
See base class member description: System.Reflection.Assembly.IsDefined Indicates whether a custom attribute identified by the specified Type is defined. |
LoadModule (inherited from System.Reflection.Assembly) |
Overloaded:LoadModule(string moduleName, byte[] rawModule) See base class member description: System.Reflection.Assembly.LoadModuleLoads the module, internal to this assembly, with a Common Object File Format (COFF)-based image containing an emitted module, or a resource file. |
LoadModule (inherited from System.Reflection.Assembly) |
Overloaded:LoadModule(string moduleName, byte[] rawModule, byte[] rawSymbolStore) See base class member description: System.Reflection.Assembly.LoadModuleLoads the module, internal to this assembly, with a Common Object File Format (COFF)-based image containing an emitted module, or a resource file. The raw bytes representing the symbols for the module are also loaded. |
Save | Saves this dynamic assembly to disk. |
SetCustomAttribute | Overloaded:SetCustomAttribute(CustomAttributeBuilder customBuilder) Set a custom attribute on this assembly using a custom attribute builder. |
SetCustomAttribute | Overloaded:SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) Set a custom attribute on this assembly using a specified custom attribute blob. |
SetEntryPoint | Overloaded:SetEntryPoint(MethodInfo entryMethod) Sets the entry point for this dynamic assembly, assuming that a console application is being built. |
SetEntryPoint | Overloaded:SetEntryPoint(MethodInfo entryMethod, PEFileKinds fileKind) Sets the entry point for this assembly and defines the type of the PE being built. |
ToString (inherited from System.Reflection.Assembly) |
See base class member description: System.Reflection.Assembly.ToString Returns the full name of the assembly, also known as the display name. |
ModuleResolve (inherited from System.Reflection.Assembly) |
See base class member description: System.Reflection.Assembly.ModuleResolve Occurs when the common language runtime class loader cannot resolve a reference to an internal module of an assembly through normal means. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public override string CodeBase {get;}
|
Exception Type | Condition |
---|---|
NotSupportedException | This method is not currently supported. |
StringBuilder codebase = new StringBuilder(Assembly.Load("mscorlib").CodeBase);
public override MethodInfo EntryPoint {get;}
|
public virtual string EscapedCodeBase {get;}
|
Exception Type | Condition |
---|---|
SecurityException | The caller does not have the required permission. |
public virtual Evidence Evidence {get;}
|
public virtual string FullName {get;}
|
Assembly SampleAssembly; // Instantiate a target object. Int32 Integer1 = new Int32(); Type Type1; // Set the Type instance to the target class type. Type1 = Integer1.GetType(); // Instantiate an Assembly class to the assembly housing the Integer type. SampleAssembly = Assembly.GetAssembly(Integer1.GetType()); // Write the display name of assembly including base name and version. Console.WriteLine("FullName=" + SampleAssembly.FullName);
public bool GlobalAssemblyCache {get;}
|
public override string Location {get;}
|
Exception Type | Condition |
---|---|
NotSupportedException | This method is not currently supported. |
name
fileName
Exception Type | Condition |
---|---|
ArgumentException | name has been previously defined. -or- There is another file in the assembly named fileName. -or- The length of name is zero. -or- The length of fileName is zero, or if fileName includes a path. |
ArgumentNullException | name or fileName is null. |
FileNotFoundException | If the file fileName is not found. |
The managed resources in the file are assumed to be public.
public void AddResourceFile( |
name
fileName
attribute
Exception Type | Condition |
---|---|
ArgumentException | name has been previously defined. -or- There is another file in the assembly named fileName. - or- The length of name is zero or if the length of fileName is zero. -or- fileName includes a path. |
ArgumentNullException | name or fileName is null. |
FileNotFoundException | If the file fileName is not found. |
Attributes can be specified for the managed resource.
typeName
Exception Type | Condition |
---|---|
ArgumentException | typeName is the empty string ("") or "\0anything". |
ArgumentNullException | typeName is null. |
typeName
ignoreCase
Exception Type | Condition |
---|---|
ArgumentException | typeName is the empty string ("") or "\0anything". |
ArgumentNullException | typeName is null. |
public object CreateInstance( |
typeName
ignoreCase
bindingAttr
binder
args
culture
activationAttributes
URLAttribute(http://hostname/appname/objectURI)
An array of type Object containing one or more activation attributes that can participate in the activation. An example of an activation attribute is:URLAttribute(http://hostname/appname/objectURI)
Exception Type | Condition |
---|---|
ArgumentException | typeName is the empty string ("") or "\0anything". |
ArgumentNullException | typeName is null. |
MissingFieldException | The constructor cannot be found. |
public ModuleBuilder DefineDynamicModule( |
name
Exception Type | Condition |
---|---|
ArgumentException | name begins with white space. -or- The length of name is zero. |
ArgumentNullException | name is null. |
The defined dynamic module is transient. The dynamic module is not saved, even if the parent dynamic assembly was created with AssemblyBuilderAccess.RunAndSave.
public ModuleBuilder DefineDynamicModule( |
name
emitSymbolInfo
Exception Type | Condition |
---|---|
ArgumentException | name begins with white space. -or- The length of name is zero. |
ArgumentNullException | name is null. |
ExecutionEngineException | The assembly for default symbol writer cannot be loaded. -or- The type that implements the default symbol writer interface cannot be found. |
The dynamic module is not saved, even if the parent dynamic assembly was created with AssemblyBuilderAccess.RunAndSave.
public ModuleBuilder DefineDynamicModule( |
name
fileName
Exception Type | Condition |
---|---|
ArgumentNullException | name or fileName is null. |
ArgumentException | The length of name or fileName is zero. -or- fileName contains a path specification (a directory component, for example). -or- There is a conflict with the name of another file that belongs to this assembly. |
InvalidOperationException | This assembly has been previously saved. |
NotSupportedException | This assembly was called on a dynamic assembly with AssemblyBuilderAccess.Run attribute. |
If a dynamic assembly contains more than one dynamic module, the assembly's manifest file name should match the module's name that is specified as the first argument to AssemblyBuilder.DefineDynamicModule.
public ModuleBuilder DefineDynamicModule( |
name
fileName
emitSymbolInfo
Exception Type | Condition |
---|---|
ArgumentNullException | name or fileName is null. |
ArgumentException | The length of name or fileName is zero. -or- fileName contains a path specification (a directory component, for example). -or- There is a conflict with the name of another file that belongs to this assembly. |
InvalidOperationException | This assembly has been previously saved. |
NotSupportedException | This assembly was called on a dynamic assembly with the AssemblyBuilderAccess.Run attribute. |
ExecutionEngineException | The assembly for default symbol writer cannot be loaded. -or- The type that implements the default symbol writer interface cannot be found. |
If a dynamic assembly contains more than one dynamic module, the assembly's manifest file name should match the module's name that is specified as the first argument to AssemblyBuilder.DefineDynamicModule.
public IResourceWriter DefineResource( |
name
description
fileName
Exception Type | Condition |
---|---|
ArgumentException | name has been previously defined. -or- There is another file in the assembly named fileName. -or- The length of name is zero. -or- The length of fileName is zero. -or- fileName includes a path. |
ArgumentNullException | name or fileName is null. |
fileName should not be the same as that of any other persistable module, stand-alone managed resource, or the stand-alone manifest file.
The runtime calls the ResourceWriter.Close method when the dynamic assembly is saved.
public IResourceWriter DefineResource( |
name
description
fileName
attribute
Exception Type | Condition |
---|---|
ArgumentException | name has been previously defined or if there is another file in the assembly named fileName. -or- The length of name is zero. -or- The length of fileName is zero. -or- fileName includes a path. |
ArgumentNullException | name or fileName is null. |
fileName should not be the same as that of any other persistable module, standalone managed resource, or the standalone manifest file.
The runtime calls the ResourceWriter.Close method when the dynamic assembly is saved.
~AssemblyBuilder(); |
inherit
A pseudo-attribute indicates bits of the core metadata that must be set when the attribute is present. Unlike a custom attribute that extends the metadata for a type and is saved along with the type, a pseudo-attribute modifies the metadata for the type and then is discarded. Some of the resulting bits cannot be accessed using existing reflection APIs.
The following table summarizes the different pseudo-attributes and the accessors for the bits that are available in reflection.
Pseudo-Attribute | Metadata Bits | Reflection Accessor |
---|---|---|
DllImportAttribute | CorPInvokeMap DLL name | No accessor for PInvokeMap for ordinary method/global method attributes. No accessor for DLL name. |
GuidAttribute | Stored as a real custom attribute. | Accessed as a real custom attribute. |
ComImportAttribute | CorTypeAttr.tdImport | Type.Attributes.Import |
SerializableAttribute | CorTypeAttr.tdSerializable | Type.Attributes.Serializable |
NonSerializedAttribute | CorFieldAttr.fdNotSerialized | FieldInfo.Attributes.NotSerialized |
MethodImplAttribute | CorMethodImpl | MethodInfo.GetMethodImplementationFlags() ConstructorInfo.GetMethodImplementationFlags() |
MarshalAsAttribute | Various bits. | No accessor. |
PreserveSigAttribute | CorMethodImpl.miOLE | MethodInfo.GetMethodImplementationFlags().OLE ConstructorInfo.GetMethodImplementationFlags().OLE |
InAttribute | CorParamAttr.pdIn | ParameterInfo.Attributes.In |
OutAttribute | CorParamAttr.pdOut | ParameterInfo.Attributes.Out |
StructLayoutAttribute | CorTypeAttr.tdLayoutSequential CorTypeAttr.tdExplicitLayout CorTypeAttr.tdAnsiClass CorTypeAttr.tdUnicodeClass CorTypeAttr.tdAutoClass Class packing. | Type.Attributes.LayoutSequential Type.Attributes.ExplicitLayout Type.Attributes.AnsiClass Type.Attributes.UnicodeClass Type.Attributes.AutoClass No accessor. |
FieldOffsetAttribute | Field offset. | No accessor. |
AssemblyLoadAttribute | CorAssemblyFlags | No accessor or enumerator. |
attributeType
inherit
Exception Type | Condition |
---|---|
ArgumentNullException | attributeType is null. |
ArgumentException | attributeType is not a runtime type. |
public ModuleBuilder GetDynamicModule( |
name
Exception Type | Condition |
---|---|
ArgumentNullException | name is null. |
ArgumentException | The length of name is zero. |
public override Type[] GetExportedTypes(); |
Exception Type | Condition |
---|---|
NotSupportedException | This method is not implemented. |
public override FileStream GetFile( |
name
Exception Type | Condition |
---|---|
NotSupportedException | This method is not currently supported. |
public virtual FileStream[] GetFiles(); |
public override FileStream[] GetFiles( |
getResourceModules
Exception Type | Condition |
---|---|
NotSupportedException | This method is not currently supported. |
public virtual int GetHashCode(); |
public Module[] GetLoadedModules(); |
getResourceModules
public override ManifestResourceInfo GetManifestResourceInfo( |
resourceName
Exception Type | Condition |
---|---|
NotSupportedException | This method is not currently supported. |
public override string[] GetManifestResourceNames(); |
Exception Type | Condition |
---|---|
NotSupportedException | This method is not supported on a dynamic assembly. To get the manifest resource names, use Assembly.GetManifestResourceNames. |
name
Exception Type | Condition |
---|---|
NotSupportedException | This method is not currently supported. |
type
name
Exception Type | Condition |
---|---|
NotSupportedException | This method is not currently supported. |
name
Classes in the Reflection.Emit namespace emit the scope name for a dynamic module. The scope name can be determined by the Module.ScopeName property. Pass the kind of module you want to Assembly.GetModule. For example, if you want the module that contains the assembly manifest, pass the scope name of the module to GetModule. Otherwise, pass the file name of the module. Assemblies loaded by one of the Load methods that have a byte[] parameter have only one module, and that is the manifest module. Always seek these modules using the scope name.
A type can be retrieved from a specific module using Module.GetType. Calling Module.GetType on the module containing the manifest will not initiate a search of the entire assembly. To retrieve a type from an assembly, regardless of which module it is in, you must call Assembly.GetType.
public Module[] GetModules(); |
Exception Type | Condition |
---|---|
FileNotFoundException | The module to be loaded does not specify a file name extension. |
Assembly mainAssembly = Assembly.GetExecutingAssembly(); Module mainMod = mainAssembly.GetModules()[0];
getResourceModules
public virtual AssemblyName GetName(); |
public virtual AssemblyName GetName( |
copiedName
public virtual void GetObjectData( |
info
context
Exception Type | Condition |
---|---|
ArgumentNullException | info is null. |
public AssemblyName[] GetReferencedAssemblies(); |
public Assembly GetSatelliteAssembly( |
culture
Exception Type | Condition |
---|---|
ArgumentNullException | culture is null. |
FileNotFoundException | The assembly cannot be found. |
FileLoadException | The satellite assembly with a matching file name was found, but the CultureInfo did not match the one specified. |
Call this method to use your current assembly version.
public Assembly GetSatelliteAssembly( |
culture
version
Exception Type | Condition |
---|---|
ArgumentNullException | culture is null. |
FileLoadException | The satellite assembly with a matching file name was found, but the CultureInfo or the version did not match the one specified. |
FileNotFoundException | The assembly cannot be found. |
Call GetSatelliteAssembly to use your current assembly version.
If version is null, the current assembly version is used if both the resource and main assemblies are signed.
public Type GetType(); |
name
Exception Type | Condition |
---|---|
ReflectionTypeLoadException | The type is not in the assembly instance you are calling the method on. |
ArgumentException | name is invalid. |
ArgumentNullException | name is null. |
SecurityException | The caller does not have the required permission. |
name
throwOnError
Exception Type | Condition |
---|---|
ArgumentNullException | name is null. |
name
throwOnError
ignoreCase
Exception Type | Condition |
---|---|
ArgumentNullException | name is null. |
public virtual Type[] GetTypes(); |
Assembly SampleAssembly; SampleAssembly = Assembly.LoadFrom("c:\\Sample.Assembly.dll"); // Obtain a reference to a method known to exist in assembly. MethodInfo Method = SampleAssembly.GetTypes()[0].GetMethod("Method1"); // Obtain a reference to the parameters collection of the MethodInfo instance. ParameterInfo[] Params = Method.GetParameters(); // Display information about method parameters. // Param = sParam1 // Type = System.String // Position = 0 // Optional=False foreach (ParameterInfo Param in Params){ Console.WriteLine("Param=" + Param.Name.ToString()); Console.WriteLine(" Type=" + Param.ParameterType.ToString()); Console.WriteLine(" Position=" + Param.Position.ToString()); Console.WriteLine(" Optional=" + Param.IsOptional.ToString()); }
attributeType
inherit
Exception Type | Condition |
---|---|
ArgumentNullException | attributeType is null. |
moduleName
rawModule
Exception Type | Condition |
---|---|
ArgumentNullException | moduleName or rawModule is null. |
ArgumentException | moduleName does not match a File entry in this assembly's manifest. |
BadImageFormatException | rawModule is not a valid module. |
SecurityException | The caller does not have the required permission. |
moduleName
rawModule
rawSymbolStore
Exception Type | Condition |
---|---|
ArgumentNullException | moduleName or rawModule is null. |
ArgumentException | moduleName does not match a File entry in this assembly's manifest. |
BadImageFormatException | rawModule is not a valid module. |
SecurityException | The caller does not have the required permission. |
protected object MemberwiseClone(); |
public void Save( |
assemblyFileName
Exception Type | Condition |
---|---|
ArgumentException | The length of assemblyFileName is 0. -or- There are two or more modules resource files in the assembly with the same name. -or- The target directory of the assembly is invalid. -or- assemblyFileName is not a simple file name (for example, has a directory or drive component) or more than unmanaged resource, including version information resource, was defined in this assembly. -or- The CultureInfo string in AssemblyCultureAttribute is not a valid string and System.Reflection.Emit.AssemblyBuilder.DefineVersionInfoResource (not supported on the shared source CLI) was called prior to calling this method. |
ArgumentNullException | assemblyFileName is null. |
InvalidOperationException | This assembly has been saved before. -or- This assembly has access Run AssemblyBuilderAccess |
IOException | If any output error occurs during the save. |
NotSupportedException | If TypeBuilder.CreateType has not been called for any of the types in the modules of the assembly to be written to disk. |
For each ResourceWriter obtained using AssemblyBuilder.DefineResource, this method writes the .resources file and calls ResourceWriter.Close to close the stream.
The assemblyFileName needs to be a simple file name without a drive or directory component. To create an assembly in a specific directory, use one of the AppDomain.DefineDynamicAssembly methods that takes a target directory argument.
public void SetCustomAttribute( |
customBuilder
Exception Type | Condition |
---|---|
ArgumentNullException | con is null. |
public void SetCustomAttribute( |
con
binaryAttribute
Exception Type | Condition |
---|---|
ArgumentNullException | con or binaryAttribute is null. |
public void SetEntryPoint( |
entryMethod
Exception Type | Condition |
---|---|
ArgumentNullException | entryMethod is null. |
InvalidOperationException | entryMethod is not contained within this assembly. |
public void SetEntryPoint( |
entryMethod
fileKind
Exception Type | Condition |
---|---|
ArgumentNullException | entryMethod is null. |
InvalidOperationException | entryMethod is not contained within this assembly. |
public override string ToString(); |
public event ModuleResolveEventHandler ModuleResolve;
|