Assembly.ReflectionOnlyLoad Method

Definition

Loads an assembly into the reflection-only context, where it can be examined but not executed.

Overloads

Name Description
ReflectionOnlyLoad(Byte[])
Obsolete.

Loads the assembly from a common object file format (COFF)-based image containing an emitted assembly. The assembly is loaded into the reflection-only context of the caller's application domain.

ReflectionOnlyLoad(String)
Obsolete.

Loads an assembly into the reflection-only context, given its display name.

ReflectionOnlyLoad(Byte[])

Source:
Assembly.cs
Source:
Assembly.cs
Source:
Assembly.cs
Source:
Assembly.cs
Source:
Assembly.cs

Caution

ReflectionOnly loading is not supported and throws PlatformNotSupportedException.

Loads the assembly from a common object file format (COFF)-based image containing an emitted assembly. The assembly is loaded into the reflection-only context of the caller's application domain.

public:
 static System::Reflection::Assembly ^ ReflectionOnlyLoad(cli::array <System::Byte> ^ rawAssembly);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")]
[System.Obsolete("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId="SYSLIB0018", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Reflection.Assembly ReflectionOnlyLoad(byte[] rawAssembly);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly ReflectionOnlyLoad(byte[] rawAssembly);
public static System.Reflection.Assembly ReflectionOnlyLoad(byte[] rawAssembly);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")>]
[<System.Obsolete("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId="SYSLIB0018", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member ReflectionOnlyLoad : byte[] -> System.Reflection.Assembly
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")>]
static member ReflectionOnlyLoad : byte[] -> System.Reflection.Assembly
static member ReflectionOnlyLoad : byte[] -> System.Reflection.Assembly
Public Shared Function ReflectionOnlyLoad (rawAssembly As Byte()) As Assembly

Parameters

rawAssembly
Byte[]

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

Returns

The loaded assembly.

Attributes

Exceptions

rawAssembly is null.

rawAssembly is not a valid assembly for the currently loaded runtime.

rawAssembly cannot be loaded.

.NET Core and .NET 5+ only: In all cases.

Remarks

You cannot execute code from an assembly loaded into the reflection-only context. To execute code, the assembly must be loaded into the execution context as well, using the Load method.

The reflection-only context is no different from other contexts. Assemblies that are loaded into the context can be unloaded only by unloading the application domain.

Applies to

ReflectionOnlyLoad(String)

Source:
Assembly.cs
Source:
Assembly.cs
Source: