The parameter to Assembly.Load includes the full specification of the dll to be loaded. Use another method, and you might end up with
a dll other than the one you expected.
This rule raises an issue when Assembly.LoadFrom, Assembly.LoadFile, or Assembly.LoadWithPartialName is
called.
Exceptions
The rule does not raise an issue when the methods are used within an AssemblyResolve event handler. In this context,
using Assembly.Load can cause a StackOverflowException due to recursive event firing, making Assembly.LoadFrom
or Assembly.LoadFile the appropriate choices.
static void Main()
{
AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;
}
static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args)
{
return Assembly.LoadFrom("MyAssembly.dll"); // Compliant: within AssemblyResolve handler
}