J
Jesse Houwing
Hey all,
I've implemented a simple plug-in based file parser for a customer and
I'm running into CA2001, which I'd like to solve.
The problem is that I cannot find any information on how to solve this
error, other than removing my call to Assembly.LoadFile. There are some
alternatives, but they are either also in the blacklist for CA2001, or
they're deprecated.
What I'm trying to accomplish is to load my file format description
(classes decorated with custom attributes) from a specific directory
(e.g. /bin/formats).
I'm using the following code:
foreach (string dll in
Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(),
"Formats"), "*.dll"))
{
Assembly ass = Assembly.LoadFile(dll);
Type[] types = ass.GetTypes();
}
Any other approaches I could use for this? Can I tell the framework to
load all my assemblies by adding a config directive? Or is there a Load*
method in Assembly that I might have missed?
I've implemented a simple plug-in based file parser for a customer and
I'm running into CA2001, which I'd like to solve.
The problem is that I cannot find any information on how to solve this
error, other than removing my call to Assembly.LoadFile. There are some
alternatives, but they are either also in the blacklist for CA2001, or
they're deprecated.
What I'm trying to accomplish is to load my file format description
(classes decorated with custom attributes) from a specific directory
(e.g. /bin/formats).
I'm using the following code:
foreach (string dll in
Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(),
"Formats"), "*.dll"))
{
Assembly ass = Assembly.LoadFile(dll);
Type[] types = ass.GetTypes();
}
Any other approaches I could use for this? Can I tell the framework to
load all my assemblies by adding a config directive? Or is there a Load*
method in Assembly that I might have missed?