Class ClrAssemblyReader
Reads information about assemblies in the CLR isntances of external processes using ClrMD
Inheritance
Inherited Members
Namespace: CilTools.Runtime
Assembly: CilTools.Runtime.dll
Syntax
public class ClrAssemblyReader
Constructors
ClrAssemblyReader(ClrRuntime)
Creates ClrAssemblyReader
to read information from the specified CLR instance
Declaration
public ClrAssemblyReader(ClrRuntime r)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Diagnostics.Runtime.ClrRuntime | r | Source CLR instance |
Properties
SourceRuntime
Gets the CLR instance associated with this ClrAssemblyReader
Declaration
public ClrRuntime SourceRuntime { get; }
Property Value
Type | Description |
---|---|
Microsoft.Diagnostics.Runtime.ClrRuntime |
Methods
AddPreloadedAssembly(Assembly)
Adds the specified assembly into the preloaded assembly collection
Declaration
public void AddPreloadedAssembly(Assembly ass)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.Assembly | ass | Preloaded assembly instance |
Remarks
Adding preloaded assemblies enables some CilTools.Runtime
mechanisms to avoid
expensive AssemblyReader.Read
calls. The preloaded assembly must implement
ITokenResolver interface to be useful.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Assembly is null |
ClearPreloadedAssemblies()
Removes all assemblies from the preloaded assembly collection
Declaration
public void ClearPreloadedAssemblies()
EnumerateMethods(Process)
Gets the collection of all methods in the specified process
Declaration
public static IEnumerable<MethodBase> EnumerateMethods(Process process)
Parameters
Type | Name | Description |
---|---|---|
System.Diagnostics.Process | process | Source process |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Reflection.MethodBase> |
EnumerateModuleMethods(Process, String)
Gets the collection of all methods defined in the specified module of the process
Declaration
public static IEnumerable<MethodBase> EnumerateModuleMethods(Process process, string modulename = "")
Parameters
Type | Name | Description |
---|---|---|
System.Diagnostics.Process | process | Source process |
System.String | modulename | Name of PE module file (without full path), or an empty string to use main module |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Reflection.MethodBase> |
GetDynamicMethods()
Gets the pseudo-assembly that represents the collection of dynamic methods in the process containing the CLR instance
Declaration
public DynamicMethodsAssembly GetDynamicMethods()
Returns
Type | Description |
---|---|
DynamicMethodsAssembly |
GetDynamicMethods(Process)
Gets the pseudo-assembly that represents the collection of dynamic methods in the specified process
Declaration
public static DynamicMethodsAssembly GetDynamicMethods(Process process)
Parameters
Type | Name | Description |
---|---|---|
System.Diagnostics.Process | process | Source process |
Returns
Type | Description |
---|---|
DynamicMethodsAssembly |
GetMemoryImage(ClrModule)
Gets the executable image data for the specified module
Declaration
public static MemoryImage GetMemoryImage(ClrModule module)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Diagnostics.Runtime.ClrModule | module | The ClMD module object |
Returns
Type | Description |
---|---|
MemoryImage | In-memory executable image data, or |
Remarks
This method gets the executable image data loaded into the target process. This enables you to inspect that image with PE reader libraries without the extra cost of reading the image from file. The method can fail if the memory pages where the image is stored are inaccessible. It also does not work for memory-only dynamic modules that don't have the backing PE image.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | module is |
Read(ClrModule)
Gets the assembly information object for the specified ClrMD module object
Declaration
public ClrAssemblyInfo Read(ClrModule module)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Diagnostics.Runtime.ClrModule | module | ClrMD module object |
Returns
Type | Description |
---|---|
ClrAssemblyInfo |
Read(String)
Gets the assembly information object for the specified module name
Declaration
public ClrAssemblyInfo Read(string modulename)
Parameters
Type | Name | Description |
---|---|---|
System.String | modulename | Name of PE module file (without full path) |
Returns
Type | Description |
---|---|
ClrAssemblyInfo |