提交 d9de8a60 编写于 作者: T Tom Meschter

Merge pull request #865 from tmeschter/HandleExceptionsInAssemblyResolve

Don't leak exceptions from AssemblyResolve handler
......@@ -148,16 +148,28 @@ private static Assembly LoadCore(string fullPath)
/// <summary>
/// Handles the <see cref="AppDomain.AssemblyResolve"/> event.
/// </summary>
/// <remarks>
/// This handler catches and swallow any and all exceptions that
/// arise, and simply returns null when they do. Leaking an exception
/// from the event handler may interrupt the entire assembly
/// resolution process, which is undesirable.
/// </remarks>
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
if (args.RequestingAssembly == null)
{
return ResolveForUnknownRequestor(args.Name);
}
else
try
{
return ResolveForKnownRequestor(args.Name, args.RequestingAssembly);
if (args.RequestingAssembly == null)
{
return ResolveForUnknownRequestor(args.Name);
}
else
{
return ResolveForKnownRequestor(args.Name, args.RequestingAssembly);
}
}
catch { }
return null;
}
/// <summary>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册