语言

Assembly.ReflectionOnlyLoad 方法

定义

将程序集加载到仅反射上下文中,可在其中检查程序集,但不能执行。

重载

名称 说明
ReflectionOnlyLoad(Byte[])
已过时.

从基于公共对象文件格式(COFF)的图像加载程序集,其中包含发出的程序集。 程序集加载到调用方应用程序域的仅反射上下文中。

ReflectionOnlyLoad(String)
已过时.

给定程序集的显示名称,将程序集加载到仅反射上下文中。

ReflectionOnlyLoad(Byte[])

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

注意

ReflectionOnly loading is not supported and throws PlatformNotSupportedException.

从基于公共对象文件格式(COFF)的图像加载程序集,其中包含发出的程序集。 程序集加载到调用方应用程序域的仅反射上下文中。

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

参数

rawAssembly
Byte[]

一个字节数组,它是基于 COFF 的映像,其中包含发出的程序集。

返回

加载的程序集。

属性

例外

rawAssembly 是 null。

rawAssembly 不是当前加载的运行时的有效程序集。

rawAssembly 无法加载。

仅限 .NET Core 和 .NET 5+ :在所有情况下。

注解

不能从加载到仅反射上下文的程序集中执行代码。 若要执行代码,还必须使用 Load 该方法将程序集加载到执行上下文中。

仅反射上下文与其他上下文不同。 加载到上下文中的程序集只能通过卸载应用程序域来卸载。

适用于

ReflectionOnlyLoad(String)

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

注意

ReflectionOnly loading is not supported and throws PlatformNotSupportedException.

给定程序集的显示名称,将程序集加载到仅反射上下文中。

public:
 static System::Reflection::Assembly ^ ReflectionOnlyLoad(System::String ^ assemblyString);
[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(string assemblyString);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly ReflectionOnlyLoad(string assemblyString);
public static System.Reflection.Assembly ReflectionOnlyLoad(string assemblyString);
[<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 : string -> System.Reflection.Assembly
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")>]
static member ReflectionOnlyLoad : string -> System.Reflection.Assembly
static member ReflectionOnlyLoad : string -> System.Reflection.Assembly
Public Shared Function ReflectionOnlyLoad (assemblyString As String) As Assembly

参数

assemblyString
String

由属性返回 FullName 的程序集的显示名称。

返回

加载的程序集。

属性

例外

assemblyString 是 null。

assemblyString 是空字符串(“)。

找不到 assemblyString。

assemblyString 已找到,但无法加载。

assemblyString 不是当前加载的运行时的有效程序集。

仅限 .NET Core 和 .NET 5+ :在所有情况下。

注解

依赖项不会自动加载到仅反射上下文中。

不能从加载到仅反射上下文的程序集中执行代码。 若要执行代码,还必须使用 Load 该方法将程序集加载到执行上下文中。

仅反射上下文与其他上下文不同。 加载到上下文中的程序集只能通过卸载应用程序域来卸载。

适用于