Class AssemblyResolverBase
- Namespace
- AsmResolver.DotNet
- Assembly
- AsmResolver.DotNet.dll
Provides a base implementation of an assembly resolver, that includes a collection of search directories to look into for probing assemblies.
public abstract class AssemblyResolverBase : IAssemblyResolver
- Inheritance
-
AssemblyResolverBase
- Implements
- Derived
- Inherited Members
Constructors
AssemblyResolverBase(ModuleReaderParameters)
Initializes the base of an assembly resolver.
protected AssemblyResolverBase(ModuleReaderParameters readerParameters)
Parameters
readerParametersModuleReaderParametersThe reader parameters used for reading new resolved assemblies.
Properties
FileService
Gets the file service that is used for reading files from the disk.
public IFileService FileService { get; }
Property Value
ReaderParameters
Gets the reader parameters used for reading new resolved assemblies.
public ModuleReaderParameters ReaderParameters { get; }
Property Value
SearchDirectories
Gets a collection of custom search directories that are probed upon resolving a reference to an assembly.
public IList<string> SearchDirectories { get; }
Property Value
Methods
LoadAssemblyFromFile(string)
Attempts to read an assembly from its file path.
protected virtual AssemblyDefinition LoadAssemblyFromFile(string path)
Parameters
pathstringThe path to the assembly.
Returns
- AssemblyDefinition
The assembly.
ProbeAssemblyFilePath(AssemblyDescriptor, ModuleDefinition?)
Attempts to find the file location of the provided assembly descriptor on the disk.
public abstract string? ProbeAssemblyFilePath(AssemblyDescriptor assembly, ModuleDefinition? originModule)
Parameters
assemblyAssemblyDescriptorThe assembly to locate.
originModuleModuleDefinitionThe module to assume the assembly was referenced in.
Returns
- string
The path to the assembly, or
nullif none was found.
ProbeDirectory(AssemblyDescriptor, string)
Probes a directory for the provided assembly.
protected static string? ProbeDirectory(AssemblyDescriptor assembly, string directory)
Parameters
assemblyAssemblyDescriptorThe assembly descriptor to search.
directorystringThe path to the directory to probe.
Returns
- string
The path to the assembly, or
nullif none was found.
ProbeSearchDirectories(AssemblyDescriptor, ModuleDefinition?)
Probes all search directories in SearchDirectories for the provided assembly.
protected string? ProbeSearchDirectories(AssemblyDescriptor assembly, ModuleDefinition? originModule)
Parameters
assemblyAssemblyDescriptorThe assembly descriptor to search.
originModuleModuleDefinitionThe module to assume the assembly was referenced in.
Returns
- string
The path to the assembly, or
nullif none was found.
Resolve(AssemblyDescriptor, ModuleDefinition?, out AssemblyDefinition?)
Resolves a reference to an assembly.
public ResolutionStatus Resolve(AssemblyDescriptor assembly, ModuleDefinition? originModule, out AssemblyDefinition? result)
Parameters
assemblyAssemblyDescriptorThe reference to the assembly.
originModuleModuleDefinitionThe module the assembly is assumed to be referenced in.
resultAssemblyDefinitionThe resolved assembly, or
nullif resolution failed.
Returns
- ResolutionStatus
A value describing the success or failure status of the assembly resolution.