AssemblyLoadContext.LoadFromAssemblyName(AssemblyName) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Resolves and loads an assembly given its AssemblyName.
public:
System::Reflection::Assembly ^ LoadFromAssemblyName(System::Reflection::AssemblyName ^ assemblyName);
public System.Reflection.Assembly LoadFromAssemblyName (System.Reflection.AssemblyName assemblyName);
member this.LoadFromAssemblyName : System.Reflection.AssemblyName -> System.Reflection.Assembly
Public Function LoadFromAssemblyName (assemblyName As AssemblyName) As Assembly
Parameters
- assemblyName
- AssemblyName
The object that describes the assembly to load.
Returns
The loaded assembly, or throws.
Exceptions
assemblyName
is null
.
assemblyName
is not found.
assemblyName
is not a valid assembly.
An assembly or module was loaded which did not match the assemblyName
.
Remarks
LoadFromAssemblyName loads an assembly by resolving the AssemblyName. This triggers a full resolution. The resolution fallback sequence follows this process:
The method calls Load(AssemblyName).
Important
Load(AssemblyName) must not call this method to prevent recursive stack overflow.
Unless the assembly is loaded or an exception is thrown, the method attempts to load the assembly in the default AssemblyLoadContext.
Unless the assembly is loaded or an exception is thrown, the method fires the Resolving event.
Unless the assembly is loaded or an exception is thrown, the method fires the AssemblyResolve event.
Note
FileLoadException is thrown if assemblyRef
specifies the full assembly name, and the first assembly that matches the simple name has a incompatible version or culture. The loader does not continue probing for other assemblies that match the simple name.
Each AssemblyLoadContext can load only:
- One version of an executable assembly.
- One version of a satellite assembly for each culture.