AppDomain.ResourceResolve 事件

定义

当资源解析因资源不是程序集中的有效链接资源或嵌入资源而失败时发生。Occurs when the resolution of a resource fails because the resource is not a valid linked or embedded resource in the assembly.

public:
 virtual event ResolveEventHandler ^ ResourceResolve;
[add: System.Security.SecurityCritical]
[remove: System.Security.SecurityCritical]
public event ResolveEventHandler ResourceResolve;
member this.ResourceResolve : ResolveEventHandler 
Public Custom Event ResourceResolve As ResolveEventHandler 

实现

属性

注解

此事件的 ResolveEventHandler 可以尝试查找包含该资源的程序集并返回它。The ResolveEventHandler for this event can attempt to locate the assembly containing the resource and return it.

重要

如果解析失败,则不会引发此事件,因为找不到有效链接资源的文件。This event is not raised if resolution fails because no file can be found for a valid linked resource. 如果找不到清单资源流,则会引发该方法,但如果找不到单个资源键,则不会引发此情况。It is raised if a manifest resource stream cannot be found, but it is not raised if an individual resource key cannot be found.

.NET Framework 4.NET Framework 4开始,ResolveEventArgs.RequestingAssembly 属性包含请求资源的程序集。Beginning with the .NET Framework 4.NET Framework 4, the ResolveEventArgs.RequestingAssembly property contains the assembly that requested the resource. 有关详细信息,请参阅 ResolveEventArgs.RequestingAssemblyFor more information, see ResolveEventArgs.RequestingAssembly.

若要为此事件注册事件处理程序,你必须具有所需的权限,或者引发 SecurityExceptionTo register an event handler for this event, you must have the required permissions, or a SecurityException is thrown.

有关处理事件的详细信息,请参阅处理和引发事件For more information about handling events, see Handling and Raising Events.

安全性

SecurityCriticalAttribute
需要对直接调用方的完全信任。requires full trust for the immediate caller. 部分受信任的或透明的代码不能使用此成员。This member cannot be used by partially trusted or transparent code.

适用于

另请参阅