异步 AppDomain.AssemblyResolve
async AppDomain.AssemblyResolve
我在 Winforms UI 中使用 AppDomain.AssemblyResolve 事件从远程服务器动态加载大型程序集。是否可以使我的程序集解析方法异步?
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) // how to make it async?
{
// some logic where I need to use await operator
}
Is it possible make my assembly resolve method async?
没有。事件签名是同步的,因此您的实现必须是同步的。您需要 block on asynchronous code.
我在 Winforms UI 中使用 AppDomain.AssemblyResolve 事件从远程服务器动态加载大型程序集。是否可以使我的程序集解析方法异步?
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) // how to make it async?
{
// some logic where I need to use await operator
}
Is it possible make my assembly resolve method async?
没有。事件签名是同步的,因此您的实现必须是同步的。您需要 block on asynchronous code.