Skip to content

Commit

Permalink
Bug fix in dependency detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilal Fazlani committed Jan 10, 2018
1 parent 8a619ee commit 979cee9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CommandDotNet/AppInstanceCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using CommandDotNet.Attributes;
using CommandDotNet.Models;

namespace CommandDotNet
Expand All @@ -17,7 +18,11 @@ public static object CreateInstance(Type type, IEnumerable<ArgumentInfo> constru
object instance = Activator.CreateInstance(type, values);

//detect properties
var properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
var properties = type
.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)
.Where(p=> p.GetCustomAttribute<SubCommandAttribute>() == null)
.ToList();

if (properties.Any())
{
if (dependencyResolver != null)
Expand Down

0 comments on commit 979cee9

Please sign in to comment.