I'm receiving an Exception of type "Exception Details: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information." with the following code:
public IEnumerable<Type> FindClassesOfType(Type assignTypeFrom, IEnumerable<Assembly> assemblies, bool onlyConcreteClasses = true)
{
foreach(var a in assemblies)
{
foreach (var t in a.GetTypes())
I need to Get the Types defined in each assembly but it seems that it cannot be generated.
I already performed all typical procedures related to wrong assembly creating by deleting dll´s, clean solution, reload solution, etc but nothing happened.
I would like to request ideas in order to solve this problem by finding a way to retrieve more information of the error, or find which assembly is generating problems or something like that. The current exception message is so vague to realize which is the problem.
ps: additional info, when I run the rebuild action all process are correctly generated with no errors.
The error message says everything you need, really:
try {
// your code
} catch (ReflectionTypeLoadException ex) {
// now look at ex.LoaderExceptions - this is an Exception[], so:
foreach(Exception inner in ex.LoaderExceptions) {
// write details of "inner", in particular inner.Message
}
}