LightInject.Interception.ProxyBuilder.ImplementAllConstructorsFromBaseClass method does not copy original attributes, as a result AnnotatedConstructorDependencySelector can not find InjectAttribute's in proxy constructor:
foreach (var parameterInfo in constructorInfo.GetParameters())
{
constructorBuilder.DefineParameter(
parameterInfo.Position + 1,
parameterInfo.Attributes,
parameterInfo.Name); // no custom attributes anymore, maybe use SetCustomAttribute and copy
}
Maybe something like this will work:
foreach (var parameterInfo in constructorInfo.GetParameters())
{
var parameterBuilder = constructorBuilder.DefineParameter(
parameterInfo.Position + 1,
parameterInfo.Attributes,
parameterInfo.Name);
foreach (var customAttribute in parameterInfo.CustomAttributes)
{
parameterBuilder.SetCustomAttribute(CreateCustomAttributeBuilder(customAttribute));
}
}
LightInject.Interception.ProxyBuilder.ImplementAllConstructorsFromBaseClass
method does not copy original attributes, as a resultAnnotatedConstructorDependencySelector
can not findInjectAttribute
's in proxy constructor:Maybe something like this will work: