Table of Contents

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

readerParameters ModuleReaderParameters

The 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

IFileService

ReaderParameters

Gets the reader parameters used for reading new resolved assemblies.

public ModuleReaderParameters ReaderParameters { get; }

Property Value

ModuleReaderParameters

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

IList<string>

Methods

LoadAssemblyFromFile(string)

Attempts to read an assembly from its file path.

protected virtual AssemblyDefinition LoadAssemblyFromFile(string path)

Parameters

path string

The 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

assembly AssemblyDescriptor

The assembly to locate.

originModule ModuleDefinition

The module to assume the assembly was referenced in.

Returns

string

The path to the assembly, or null if none was found.

ProbeDirectory(AssemblyDescriptor, string)

Probes a directory for the provided assembly.

protected static string? ProbeDirectory(AssemblyDescriptor assembly, string directory)

Parameters

assembly AssemblyDescriptor

The assembly descriptor to search.

directory string

The path to the directory to probe.

Returns

string

The path to the assembly, or null if none was found.

ProbeSearchDirectories(AssemblyDescriptor, ModuleDefinition?)

Probes all search directories in SearchDirectories for the provided assembly.

protected string? ProbeSearchDirectories(AssemblyDescriptor assembly, ModuleDefinition? originModule)

Parameters

assembly AssemblyDescriptor

The assembly descriptor to search.

originModule ModuleDefinition

The module to assume the assembly was referenced in.

Returns

string

The path to the assembly, or null if 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

assembly AssemblyDescriptor

The reference to the assembly.

originModule ModuleDefinition

The module the assembly is assumed to be referenced in.

result AssemblyDefinition

The resolved assembly, or null if resolution failed.

Returns

ResolutionStatus

A value describing the success or failure status of the assembly resolution.