Skip to content

Commit

Permalink
Returns the working types if some fail (#2953)
Browse files Browse the repository at this point in the history
  • Loading branch information
valadas authored and david-poindexter committed Aug 18, 2019
1 parent 189a246 commit c2ef4fe
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Reflection;

namespace DotNetNuke.DependencyInjection.Extensions
Expand Down Expand Up @@ -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<Type>();
}
catch (Exception)
{
{
//TODO: We should log the reason of the exception after the API cleanup
types = new Type[0];
}

Expand Down

0 comments on commit c2ef4fe

Please sign in to comment.