Closed tdctaz closed 5 years ago
Grace will always take the constructor with the most parameters it can satisfy. array's and lists are something it will satisfy by default (it's empty but it's still satisfied). So not what you're expecting but it's not a bug because the container can't tell if you intended to have >= 0 exports or > 0.
You have a couple options. If this is just a one off you can tell the container which constructor to use specifically. The other option is to provide your own constructor selector that takes into account if a collection will be null and not pick it.
I'll try to make a constructor selector.
But the array i'm getting is not an empty array. I'm getting an array with one object
element in it.
Sounds like the container auto registered the class Object and returned an instance in the array.
While not proper I don’t want to change the behavior of discovering object till 8.0 as it’s a breaking change.
Were you able to work out a solution?
I'm going to close this out
When Locating a class with a default constructor and a constructor with
params object[] args
the overload with theargs
always gets invoked even though no configuration forargs
was Exported. Also theargs
contains a singleobject
instance.Version: 7.0.0
Repo: