-
-
Notifications
You must be signed in to change notification settings - Fork 840
Decorator is not applied when component is registered by interface #999
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
Comments
Before we take the time to try and set this up, repro it, debug it, etc... the only difference I see in these two things is in the first one, you're registering a lambda and casting it inside the lambda...
...while the second one there's no cast.
In both cases they're registered Am I reading that right? |
@tillig , yes |
Looks like we have a bug! Thanks for the report. I'm able to reproduce this. Not sure how to fix it right now, but baby steps. |
Added failing (but skipped, for now) unit test here. |
@tillig I think that the reason is inside this condition: builder.Register(ctx => { The LimitType always be the most specific type returned in the expression (in this case is IDecoratedService) but the instance type can only be determined at runtime. Therefore it results to that all registered decorators will be ignored. My solution is to remove this condition. I have re-run all test cases after removing it and they all passed. What do you think about it or do you have any better solutions :) ? |
The |
Hi!
I'm trying to decorate a delegate component, created with a factory method, which returns an interface. I've discovered that in this case delegate is not applied.
Is it a bug or a feature?
Autofac 4.9.2
The text was updated successfully, but these errors were encountered: