Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows loading dependencies during startup even if one fails #2953

Merged
merged 2 commits into from
Aug 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@valadas can we create a follow-up issue to track this //TODO. If there is already one created can you link it in this PR

//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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@valadas can we create a follow-up issue to track this //TODO. If there is already one created can you link it in this PR

types = new Type[0];
}

Expand Down