You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 2, 2018. It is now read-only.
Spent about a day of work attempting to resolve exception thrown from the activator.
We have many services from different projects that have been registered and upon integration of all of them, attempting to resolve one the services, the activator failed and threw an error.
This error, of the form "No parameter-less constructor defined", provided absolute no context
of which service failed to resolve. We had to eventually do a process of elimination and manually go register each of the services and binary search to find out which service type that was registered was failing to resolve.
issue
The problem is caused by a private constructor and results in and exception
that may not lead you directly to the source.
Reproduce
Define a class with no public constructors, that inherits from an interface,
then register the service and try resolved the interface.
interfaceITestService{}// There are many of these classes.classTestService:ITestService{TestService(){}}
...var testServices =Container.GetServices<ITestService>();// Throws exception 'No parameter-less constructor defined'
Suggestions
Provide context to any exceptions throw in the activator,
ideally one would include information about the type being activated
to help track down the culprit(s).
Please let know if you have any future questions or if I can help out in anyway.