-
Notifications
You must be signed in to change notification settings - Fork 456
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
Bugfix ms di no available scope #662
base: master
Are you sure you want to change the base?
Bugfix ms di no available scope #662
Conversation
Conflict that StackTrace matches a namespace.
To fix issue castleproject#563 (support concurrently existing containers) a fix was created in castleproject#577. After the initial fix some refactorings were done on the scope implementation that were not correct. This commit changes the scope implementation back to the original implementation of @ltines, but with the support for concurrent containers.
I tested this code and there are cases in which it still fail in an AspNet Core project. The main issue is:
I openend another PR (#664) with some more tests and code changes to be evaluated that can help finding a solution |
I am starting to think that the safest thing to do now (at least for now) is to revert the code to the original static root sope, so that the code is 100% compatible with the earlier version of the extension. Then we no longer support concurrent containers, but existing code should not have problems and it would allow existing projects to upgrade to the new version. I do want to explore this further, but I am afraid it will take some time to have a good solution. What do you think? Ruben |
@rvdginste I'm happy to leave that decision to you guys who are using it. My only request is to keep all the additional unit tests you are writing, and if you plan on restoring concurrent containers in the future keep them separate and mark /cc @AGiorgetti |
I have no problem reverting the code as long as we keep all the tests (I added even more checking what happens when you attempt to resolve services with different lifecycles in another PR #664) Looking at the code of dotnet DI you can see that they use a root scope tied to each ServiceProvider they create from the factory; some of the thing we should investigate to support "concurrent" containers (they are not anyway, because the underlying instance of castle windsor is always the same) - imo - are:
Another thing to investigate is how Singleton are handled, I'm not sure having a custom NetStatic lifecycle is a good idea given the fact that under the hood we have a single WindsorContainer instance... why not use the standard Singleton behavior? |
For some reason I'm not aware of, my code that used to work with previous versions does not work with the latest. I have added a comment in #595 but I think it's worth having it here. |
Fixes #646