diff --git a/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs b/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs index fc7e1476e0d..ba2df293d58 100644 --- a/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs +++ b/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Reflection; namespace DotNetNuke.DependencyInjection.Extensions @@ -32,8 +33,15 @@ public static Type[] SafeGetTypes(this Assembly assembly) { types = assembly.GetTypes(); } + catch (ReflectionTypeLoadException ex) + { + //TODO: We should log the reason of the exception after the API cleanup + //Ensure that Dnn obtains all types that were loaded, ignoring the failure(s) + types = ex.Types.Where(x => x != null).ToArray(); + } catch (Exception) - { + { + //TODO: We should log the reason of the exception after the API cleanup types = new Type[0]; }