The Assembly.GetTypes() method returns a list of all types declared in the assembly. However, sometimes it happens that some dependencies for a part of the types declared in an assembly are not available, and some types cannot be loaded. In this case, the method throws an exception and returns nothing.

How to make so that if some types are not available, it would be possible to see what you managed to download?

    1 answer 1

    Strangely, MSDN says that the result will still be returned, but the types that could not be reflected will be returned as Nothing :

    ReflectionTypeLoadException

    An assembly contains one or more types that cannot be loaded. The array returned by the Types property of this exception contains a Type object for each loaded type and a Nothing value for each type that failed to load, while the LoaderExceptions property contains an exception for each type that was not loaded.

    Accordingly, catch this right in the same place, make the necessary rollback for unloaded types and work with the fact that it is not Nothing .