Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Assembly.LoadFile and Code Analysis warning CA2001

Reply
 
Old 10-30-2009   #1 (permalink)
Jesse Houwing


 
 

Assembly.LoadFile and Code Analysis warning CA2001

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?

--
Jesse Houwing
jesse.houwing at sogeti.nl

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Code analysis tool? .NET General
Error Code Analysis Vista General
VS 2008 & Code Analysis .NET General
Assembly.LoadFile and nested PS instance PowerShell
[Reflection.Assembly]::LoadFile locks file PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46