Export (0) Print
Expand All

Assembly.Load Method (Byte[], Byte[])

Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally including symbols for the assembly. The assembly is loaded into the application domain of the caller.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

public static Assembly Load(
	byte[] rawAssembly,
	byte[] rawSymbolStore
)

Parameters

rawAssembly
Type: System.Byte[]

A byte array that is a COFF-based image containing an emitted assembly.

rawSymbolStore
Type: System.Byte[]

A byte array that contains the raw bytes representing the symbols for the assembly.

Return Value

Type: System.Reflection.Assembly
The loaded assembly.

ExceptionCondition
ArgumentNullException

rawAssembly is null.

BadImageFormatException

rawAssembly is not a valid assembly.

-or-

Version 2.0 or later of the common language runtime is currently loaded and rawAssembly was compiled with a later version.

The trust level of an assembly that is loaded by using this method is the same as the trust level of the calling assembly. To load an assembly from a byte array with the trust level of the application domain, use the Load(Byte[], Byte[], SecurityContextSource) method overload. For more information about the use of evidence with overloads of the Load method that take byte arrays, see the Load(Byte[], Byte[], Evidence) method overload.

Reflecting on C++ executable files might throw a BadImageFormatException. This is most likely caused by the C++ compiler stripping the relocation addresses or the .reloc section from your executable file. To preserve the .reloc address for your C++ executable file, specify /fixed:no when you are linking.

Note that this method overload always creates a new Assembly object with its own mapping.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft