Class DynamicMethodsAssembly
Represents the pseudo-assembly that contains a collection of dynamic methods in the external process
Inheritance
Implements
Inherited Members
Namespace: CilTools.Runtime
Assembly: CilTools.Runtime.dll
Syntax
public sealed class DynamicMethodsAssembly : Assembly, _Assembly, IEvidenceFactory, ICustomAttributeProvider, ISerializable, IDisposable
Constructors
DynamicMethodsAssembly(DataTarget, ClrAssemblyReader, Boolean)
Creates new DynamicMethodsAssembly
object for the specified data target, optionally
providing the ClrAssemblyReader instance and indicating whether the created object
owns the data target.
Declaration
public DynamicMethodsAssembly(DataTarget dt, ClrAssemblyReader r, bool autoDispose)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Diagnostics.Runtime.DataTarget | dt | ClrMD data target to read information from |
ClrAssemblyReader | r | Assembly reader object to read dependent assemblies. |
System.Boolean | autoDispose |
|
Remarks
If the supplied ClrAssemblyReader is null, the constructor will create new assembly reader instance using the supplied data target.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Supplied data target is null |
DynamicMethodsAssembly(DataTarget, Boolean)
Creates new DynamicMethodsAssembly
object for the specified data target, optionally indicating whether the created object
owns the data target.
Declaration
public DynamicMethodsAssembly(DataTarget dt, bool autoDispose)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Diagnostics.Runtime.DataTarget | dt | ClrMD data target to read information from |
System.Boolean | autoDispose |
|
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Supplied data target is null |
Properties
AssemblyReader
Gets the assembly reader object used to read dependent assemblies
Declaration
public ClrAssemblyReader AssemblyReader { get; }
Property Value
Type | Description |
---|---|
ClrAssemblyReader |
Remarks
When dynamic method references a member from the external assembly, the library will use this assembly reader object when resolving metadata tokens from the external assembly. The assembly reader acts as cache that stores assembly instance so we don't need to load them multiple times.
ChildType
Gets pseudo-type that contains the collection of dynamic methods
Declaration
public Type ChildType { get; }
Property Value
Type | Description |
---|---|
System.Type |
CodeBase
Gets the full path to the assembly. This implementation always returns an empty string.
Declaration
public override string CodeBase { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
EntryPoint
Gets an entry point method for this assembly
Declaration
public override MethodInfo EntryPoint { get; }
Property Value
Type | Description |
---|---|
System.Reflection.MethodInfo | This implementation always returns null |
Overrides
ExportedTypes
Gets a collection of the public types defined in this assembly that are visible outside the assembly.
Declaration
public override IEnumerable<Type> ExportedTypes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Type> |
Overrides
Remarks
This implementation returns an empty collection
FullName
Gets the display name of the assembly
Declaration
public override string FullName { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
IsDynamic
Gets a value that indicates whether the current assembly was generated dynamically at runtime.
Declaration
public override bool IsDynamic { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
Remarks
This implementation always returns true
Location
Gets the full path to the assembly. This implementation always returns an empty string.
Declaration
public override string Location { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
ManifestModule
Gets a module that contains the assembly manifest
Declaration
public override Module ManifestModule { get; }
Property Value
Type | Description |
---|---|
System.Reflection.Module | This implementation always returns null |
Overrides
ReflectionOnly
Gets a boolean value indicating whether this assembly was loaded into the reflection-only context.
Declaration
public override bool ReflectionOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean | This implementation always returns |
Overrides
Target
ClrMD data target associated with this instance
Declaration
public DataTarget Target { get; }
Property Value
Type | Description |
---|---|
Microsoft.Diagnostics.Runtime.DataTarget |
Methods
Dispose()
Releases unmagnaged resources associated with this assembly object
Declaration
public void Dispose()
Remarks
This method only disposes the underlying data target if this instance was constructed with the autoDispose
parameter set to true.
EnumerateMethods()
Gets the collection of all methods defined in this assembly
Declaration
public IEnumerable<MethodBase> EnumerateMethods()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Reflection.MethodBase> |
GetExportedTypes()
Gets the public types defined in this assembly that are visible outside the assembly.
Declaration
public override Type[] GetExportedTypes()
Returns
Type | Description |
---|---|
System.Type[] | An array that represents the types defined in this assembly that are visible outside the assembly. |
Overrides
Remarks
This implementation returns an empty array
GetName()
Gets an AssemblyName for this assembly
Declaration
public override AssemblyName GetName()
Returns
Type | Description |
---|---|
System.Reflection.AssemblyName | An object that contains the fully parsed display name for this assembly |
Overrides
GetReferencedAssemblies()
Gets an array of assembly names for assemblies referenced by this assembly
Declaration
public override AssemblyName[] GetReferencedAssemblies()
Returns
Type | Description |
---|---|
System.Reflection.AssemblyName[] | This implementation always returns an empty array |
Overrides
GetType(String)
Gets the Type
object that represents the specified type.
Declaration
public override Type GetType(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The full name of the type. |
Returns
Type | Description |
---|---|
System.Type | An object that represents the specified type, or |
Overrides
GetType(String, Boolean)
Gets the Type
object with the specified name in the assembly instance and optionally throws an exception if the type is not found.
Declaration
public override Type GetType(string name, bool throwOnError)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The full name of the type. |
System.Boolean | throwOnError | true to throw an exception if the type is not found; false to return null. |
Returns
Type | Description |
---|---|
System.Type | An object that represents the specified type. |
Overrides
GetType(String, Boolean, Boolean)
Gets the Type
object with the specified name in the assembly instance, with the options of ignoring the case, and of throwing an exception if the type is not found.
Declaration
public override Type GetType(string name, bool throwOnError, bool ignoreCase)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The full name of the type. |
System.Boolean | throwOnError | true to throw an exception if the type is not found; false to return null. |
System.Boolean | ignoreCase | true to ignore the case of the type name; otherwise, false. |
Returns
Type | Description |
---|---|
System.Type | An object that represents the specified type. |
Overrides
GetTypes()
Gets the types defined in this assembly.
Declaration
public override Type[] GetTypes()
Returns
Type | Description |
---|---|
System.Type[] | An array that contains all the types that are defined in this assembly. |
Overrides
Remarks
This implementation returns collection that consists of the single pseudo-type representing dynamic methods