public static void Refresh(Assembly assembly) { if (assembly == null) { Debug.Fail("COMPAT: Returning, but you should not pass null here"); return; } foreach (Module mod in assembly.GetModules()) { Refresh(mod); } }
public static void ClearCache(Type[]?types) { // ReflectTypeDescriptionProvider maintains global caches on top of reflection. // Clear those. ReflectTypeDescriptionProvider.ClearReflectionCaches(); // Each type descriptor may also cache reflection-based state that it gathered // from ReflectTypeDescriptionProvider. Clear those as well. if (types is not null) { foreach (Type type in types) { TypeDescriptor.Refresh(type); } } else { foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { TypeDescriptor.Refresh(assembly); } } }