Assembly.ReflectionOnlyLoad Method
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.
Loads an assembly into the reflection-only context, where it can be examined but not executed.
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. |
- 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);
public static System.Reflection.Assembly ReflectionOnlyLoad (byte[] rawAssembly);
[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);
static member ReflectionOnlyLoad : byte[] -> System.Reflection.Assembly
[<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
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
- Source:
- Assembly.cs
- Source:
- Assembly.cs
- Source:
- Assembly.cs
Caution
ReflectionOnly loading is not supported and throws PlatformNotSupportedException.
Loads an assembly into the reflection-only context, given its display name.
public:
static System::Reflection::Assembly ^ ReflectionOnlyLoad(System::String ^ assemblyString);
public static System.Reflection.Assembly ReflectionOnlyLoad (string assemblyString);
[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 (string assemblyString);
static member ReflectionOnlyLoad : string -> System.Reflection.Assembly
[<System.Obsolete("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId="SYSLIB0018", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member ReflectionOnlyLoad : string -> System.Reflection.Assembly
Public Shared Function ReflectionOnlyLoad (assemblyString As String) As Assembly
Parameters
Returns
The loaded assembly.
- Attributes
Exceptions
assemblyString
is null
.
assemblyString
is an empty string ("").
assemblyString
is not found.
assemblyString
is found, but cannot be loaded.
assemblyString
is not a valid assembly for the currently loaded runtime.
.NET Core and .NET 5+ only: In all cases.
Remarks
Dependencies are not automatically loaded into the reflection-only context.
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
.NET feedback
.NET is an open source project. Select a link to provide feedback: