exception - Validation of .NET assemblies in C#? -
How do you check whether the assembly is a valid .NET assembly loaded? I currently have this code but unmanaged DLL has thrown BadImageFormatException.
string [] filepaths = Directory.GetFiles (Directory.GetCurrentDirectory (), "* .dll", SearchOption.AllDirectories); & Lt; Type & gt; Potential effects = new list & lt; Type & gt; (); Foreach (String phylaxate in the filepath) {assembly A = assembly. Loadfile (file path); PotentialEffects.AddRange (a.GetTypes ()); }
Can you just catch this exception?
See also this article here: Just catch the exception, assuming that a file is a valid assembly, the investigation will be much more expensive.
Comments
Post a Comment