question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Decorators does not work anymore (5.1.0-beta001)

See original GitHub issue

After upgrading from v4.x to 5.1-beta I found that the decorators does not work anymore.

Exception:

HandlerException: Can't create component 'WebApplication3UsingWindsor.DecoratedUserService' as it has dependencies to be satisfied.

'WebApplication3UsingWindsor.DecoratedUserService' is waiting for the following dependencies:
- Service 'WebApplication3UsingWindsor.IUserService' which points back to the component itself.
A dependency cannot be satisfied by the component itself, did you forget to register other components for this service?

Using: Castle.Windsor.Extensions.DependencyInjection (5.1.0-beta001)

In previous version this was working:

container.Register(Component.For<IUserService>().ImplementedBy<DecoratedUserService>());
...
container.Register(Component.For<IUserService>().ImplementedBy<UserService>());

Now only this is working:

container.Register(
			Component.For<IUserService>().ImplementedBy<DecoratedUserService>(),
			Component.For<IUserService>().ImplementedBy<UserService>()
			);

I don’t want to re-write the whole register logic in my application and try to find all occurences.

Is this new behavior by design?

I’ve attached a simple repro project. WebApplication3UsingWindsor.zip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
generik0commented, Oct 7, 2020

@jonorossi @ltines @twenzel @AntonioDrusin @robertcoltheart Got it… Anyone have time to comment / review? #556 @twenzel thanks for pointing this out. Really create.

0reactions
ltinescommented, Oct 10, 2020

HI @ltines this seams to what is causing the issue;:

image I though @robertcoltheart PR #551 but it doesn’t.

@ltines can you tell us the reason for the “AddSubSystem” in the facility? and also, can you tell us why this might be giving an issue? I see tests fail in the WindsorScopedServiceProviderTests, is it because of some resolving differences between service provider and windsor?

Thanks 😃

UPDATE. I sespect the issue is in here. DependencyInjectionNamingSubsystem, will investigate more

the custom subsystem is becuase we need specific order of components for a service to match .NET semantics

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Why do decorators not work with built in functions?
I am learning how to use decorators in Python, and I have a solid understanding of it, but I have one question -...
Read more >
How you implemented your Python decorator is wrong
For this first instalment I will simply go through the various ways in which your typical Python decorator can cause problems.
Read more >
Please Fix Your Decorators
Sadly most decorators are broken because the web is full of bad advice. (Feel free to jump directly to the conclusion if you...
Read more >
5 Advanced Tips on Python Decorators | by Michael Berk
In chapter 7 of Fluent Python, Luciano Ramalho discusses decorators and closures. They are not super common in basic DS work, however as...
Read more >
Primer on Python Decorators
In this introductory tutorial, we'll look at what Python decorators are and how to create and use them.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found