AssemblyLoadContext.Resolving AssemblyLoadContext.Resolving AssemblyLoadContext.Resolving AssemblyLoadContext.Resolving Event

定义

在尝试加载到此程序集加载上下文时,程序集解析失败时发生。Occurs when the resolution of an assembly fails when attempting to load into this assembly load context.

public:
 event Func<System::Runtime::Loader::AssemblyLoadContext ^, System::Reflection::AssemblyName ^, System::Reflection::Assembly ^> ^ Resolving;
public event Func<System.Runtime.Loader.AssemblyLoadContext,System.Reflection.AssemblyName,System.Reflection.Assembly> Resolving;
member this.Resolving : Func<System.Runtime.Loader.AssemblyLoadContext, System.Reflection.AssemblyName, System.Reflection.Assembly> 
Public Custom Event Resolving As Func(Of AssemblyLoadContext, AssemblyName, Assembly) 

注解

若要返回的程序集的指定,或返回此事件的处理程序负责null如果无法识别该程序集。It is the responsibility of the handler for this event to return the assembly that is specified, or to return null if the assembly is not recognized.

重要

如果此事件注册了多个事件处理程序,直到事件处理程序返回值不是按顺序调用事件处理程序nullIf more than one event handler is registered for this event, the event handlers are called in order until an event handler returns a value that isn't null. 后续的事件处理程序将被忽略。Subsequent event handlers are ignored.

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

它是值得注意的内容是否可以对任何此事件添加处理程序AssemblyLoadContext,包括默认上下文。It is noteworthy that a handler can be added for this event on any AssemblyLoadContext, including the default context.

适用于