lundi 2 juillet 2018

C# reflection assembly types not found for deleted classes

I have projects in my visual studio solutions . All of my solutions starts a prefix like "Lte":

  • Lte.WebApi
  • Lte.Domain
  • Lte.Data

So I am getting the types using reflection:

   public static IEnumerable<Type> GetModules<Type>()
   {
             var i = AppDomain.CurrentDomain.GetAssemblies()
                    .Where(a => a.GetName().Name.StartsWith("Lte"))
                    .SelectMany(t => t.GetTypes());

            return i;
   }

This Works, but when I delete a class in Lte.Domain Project, this method throws an error.

Unable to load one or more of the requested types.





Aucun commentaire:

Enregistrer un commentaire