Extension of response to casperOne.
If you want to capture direct Assembly Resolve events, you need to hook into the AppDomain.AssemblyResolve event. This is a global hook, although it alone is not suitable for your scenario. However, if your application is single-threaded, you can use a short link to intercept specific permission events.
static void LoadWithIntercept(string assemblyName) { var domain = AppDomain.CurrentDomain; domain.AssemblyResolve += MyInterceptMethod; try { Assembly.ReflectionOnlyLoad(assemblyName); } finally { domain.AssemblyResolve -= MyInterceptMethod; } } private static Assembly MyInterceptMethod(object sender, ResolveEventArgs e) {
Jaredpar
source share