Open friuns2 opened 5 years ago
reflectiontypeloadexception in HestleReflection on recompile
based on this, i modified HestleReflection.cs
https://stackoverflow.com/questions/7889228/how-to-prevent-reflectiontypeloadexception-when-calling-assembly-gettypes
public static IEnumerable<HasteTuple<T, MethodInfo>> GetAttributesInAssembly<T>(Assembly assembly) { var flags = BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Static|BindingFlags.DeclaredOnly; Type[] enumerable=null; try { enumerable = assembly.GetTypes(); } catch (ReflectionTypeLoadException e) { yield break; } foreach (var type in enumerable) { foreach (var methodInfo in type.GetMethods(flags)) { foreach (var attribute in methodInfo.GetCustomAttributes(typeof(T), true)) { yield return HasteTuple.Create((T)attribute, methodInfo); } } } }
reflectiontypeloadexception in HestleReflection on recompile
based on this, i modified HestleReflection.cs
https://stackoverflow.com/questions/7889228/how-to-prevent-reflectiontypeloadexception-when-calling-assembly-gettypes