Class ReflectionAssemblyDescriptor
- Namespace
- AsmResolver.DotNet
- Assembly
- AsmResolver.DotNet.dll
Provides a wrapper for Assembly that maps properties declared by Assembly onto an AssemblyDescriptor instance. This can be used for importing assemblies referenced by System.Reflection.
public class ReflectionAssemblyDescriptor : AssemblyDescriptor, IHasCustomAttribute, IMetadataMember, IFullNameProvider, INameProvider, IImportable, IModuleProvider
- Inheritance
-
ReflectionAssemblyDescriptor
- Implements
- Inherited Members
- Extension Methods
Constructors
ReflectionAssemblyDescriptor(ModuleDefinition, AssemblyName)
Creates a new instance of the ReflectionAssemblyDescriptor class.
public ReflectionAssemblyDescriptor(ModuleDefinition parentModule, AssemblyName assemblyName)
Parameters
parentModuleModuleDefinitionThe module that imports this assembly.
assemblyNameAssemblyNameThe assembly name to import.
ReflectionAssemblyDescriptor(AssemblyName)
Creates a new instance of the ReflectionAssemblyDescriptor class.
public ReflectionAssemblyDescriptor(AssemblyName assemblyName)
Parameters
assemblyNameAssemblyNameThe assembly name to import.
Properties
ContextModule
Gets the module that defines the member definition or reference.
public ModuleDefinition? ContextModule { get; }
Property Value
Remarks
For member references, this does not obtain the module definition that the member is defined in. Rather, it obtains the module definition that references this reference.
Methods
GetCulture()
Obtains the locale string of the assembly definition.
protected override Utf8String? GetCulture()
Returns
- Utf8String
The locale string.
Remarks
This method is called upon initializing the Culture property.
GetName()
Obtains the name of the assembly definition.
protected override Utf8String? GetName()
Returns
- Utf8String
The name.
Remarks
This method is called upon initializing the Name property.
GetPublicKeyToken()
When the application is signed with a strong name, obtains the public key token of the assembly
public override byte[]? GetPublicKeyToken()
Returns
- byte[]
The token.
ImportWith(ReferenceImporter)
Imports the assembly descriptor using the provided reference importer.
public override AssemblyReference ImportWith(ReferenceImporter importer)
Parameters
importerReferenceImporterThe importer object to use.
Returns
- AssemblyReference
The imported assembly reference.
IsImportedInModule(ModuleDefinition)
Determines whether the descriptor of the member is fully imported in the provided module.
public override bool IsImportedInModule(ModuleDefinition module)
Parameters
moduleModuleDefinitionThe module that is supposed to import the member.
Returns
- bool
trueif the descriptor of the member is fully imported by the module,falseotherwise.
Remarks
This method verifies all references in the descriptor of the member only. It does not verify any additional data or contents (such as a method body) associated to the member.
Resolve(RuntimeContext?, out AssemblyDefinition?)
Attempts to resolve the assembly reference to its definition.
public override ResolutionStatus Resolve(RuntimeContext? context, out AssemblyDefinition? assembly)
Parameters
contextRuntimeContextThe context to assume when resolving the assembly.
assemblyAssemblyDefinitionThe resolved assembly, or
nullif resolution failed.
Returns
- ResolutionStatus
A value describing the success or failure status of the assembly resolution.