AppDomain.CurrentDomain.GetAssemblies fails with ReflectionTypeLoadException
问题 During unittesting I have run into a problem with the following code that asks for all the loaded assemblies: var res = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(x => x.GetTypes()) .ToList(); this code fails with a ReflectionTypeLoadException which has inner exceptions of the pattern Could not load type Microsoft.Xml.Serialization.GeneratedAssembly.FOO where FOO are some specific classes also coded by us. The problem arises when running unittests prior to the above which creates XML