asynchronousasync-awaitassemblyresolve

async AppDomain.AssemblyResolve


I dynamically load large assemblies from remote server in Winforms UI using AppDomain.AssemblyResolve event. Is it possible make my assembly resolve method async?

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
}



Solution

  • Is it possible make my assembly resolve method async?

    No. The event signature is synchronous, so your implementation must be synchronous. You'll need to block on asynchronous code.