Assembly.LoadFrom Method (String, Evidence, Byte, AssemblyHashAlgorithm)
Assembly: mscorlib (in mscorlib.dll)
public: static Assembly^ LoadFrom ( String^ assemblyFile, Evidence^ securityEvidence, array<unsigned char>^ hashValue, AssemblyHashAlgorithm hashAlgorithm )
public static Assembly LoadFrom ( String assemblyFile, Evidence securityEvidence, byte hashValue, AssemblyHashAlgorithm hashAlgorithm )
public static function LoadFrom ( assemblyFile : String, securityEvidence : Evidence, hashValue : byte, hashAlgorithm : AssemblyHashAlgorithm ) : Assembly
The name or path of the file that contains the manifest of the assembly.
Evidence for loading the assembly.
The value of the computed hash code.
The hash algorithm used for hashing files and for generating the strong name.
Return ValueThe loaded assembly.
assemblyFile is a null reference (Nothing in Visual Basic).
assemblyFile is not found, or the module you are trying to load does not specify a filename extension.
A file that was found could not be loaded.
assemblyFile is not a valid assembly.
A codebase that does not start with "file://" was specified without the required WebPermission.
The assemblyFile parameter is the empty string ("").
The assembly name is longer than MAX_PATH characters.
The assemblyFile parameter must refer to a URI without escape characters. This method supplies escape characters for all invalid characters in the URI.
assemblyFile is relative to the current directory, and the assembly is loaded into the domain of the caller.
If an assembly with the same identity is already loaded, LoadFrom returns the loaded assembly even if a different path was specified.
If an assembly is loaded with LoadFrom, and later an assembly in the load context attempts to load same the assembly by display name, the load attempt fails. This can occur when an assembly is deserialized.
If an assembly is loaded with LoadFrom, and the probing path includes an assembly with the same identity but a different location, an InvalidCastException, MissingMethodException, or other unexpected behavior can occur.
If a native image exists for assemblyFile, it is not used. The assembly cannot be loaded as domain neutral.
In the .NET Framework version 1.0 and 1.1, policy is not applied.
Whether certain permissions are granted or not granted to an assembly is based on evidence. The rules for assembly and security evidence merging are as follows:
When you use a LoadFrom method with an Evidence parameter, pieces of evidence are merged. Pieces of evidence supplied as an argument to the LoadFrom method supersede pieces of evidence supplied by the loader.
If you call this method more than once on the same assembly but with a different evidence specified, the common language runtime does not throw a FileLoadException because the equality and integrity of the different evidence specifications cannot be determined. The evidence that first succeeds is the evidence that is used.
When you use a LoadFrom method with a Byte parameter to load a common object file format (COFF) image, evidence is combined. Zone, Url and Site are inherited from the calling assembly, and Hash and StrongName are taken from the COFF assembly.
When you use a LoadFrom method with a Byte parameter and Evidence to load a common object file format (COFF) image, only the supplied evidence is used. Evidence of the calling assembly and evidence of the COFF image is ignored.
- SecurityPermission to load an assembly with evidence. Associated enumeration: SecurityPermissionFlag.ControlEvidence.
- FileIOPermission for reading a URI that begins with "file://". Associated enumeration: FileIOPermissionAccess.Read
- WebPermission for reading a URI that does not begin with "file://".
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.