async AppDomain.AssemblyResolve

154 Views Asked by At

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
}


1

There are 1 best solutions below

0
Stephen Cleary On BEST ANSWER

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.