Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make sure AppDomain.CurrentDomain.AssemblyResolve event is always fired?

Tags:

c#

.net

I am trying to use some resolver to handle the resolving failure, I found the AppDomain.CurrentDomain.AssemblyResolve only works when I use something like AppDomain.CurrentDomain.Load(*); but it is refusing to fire when I use something like Assembly.LoadFrom.

How to make sure it is always get fired no matter which way I use?

like image 713
Jack Lee Avatar asked Nov 14 '22 10:11

Jack Lee


1 Answers

That's pretty unclear. But AssemblyResolve will only fire when it needs to fire because the CLR cannot find the assembly by itself. Which is somewhat likely to not be the case when you use LoadFrom() since you normally specify the full path name of the assembly.

like image 191
Hans Passant Avatar answered Nov 16 '22 04:11

Hans Passant