-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
Scope is lost in diposable service #678
Comments
Thanks, will check later. |
Hey @dadhi. Have you had chance to take a look ? We are looking for any solution, even workaround. |
@Ditriksss Looking at it now |
Hi @Ditriksss It is passing just fine. Btw, the repo is on the latest version of the DryIoc v6.0.0-preview-09 and DryIoc.Microsoft.DependencyInjection v8.0.0-preview-04 |
Hej @dadhi One insight here - if you comment line |
@Ditriksss Thanks for adding the missing code and Asserts. I am able to reproduce the issue now. |
Hey, we have following issue:
Lets say, you have service
ServiceC<Strategy>
which is disposable, so you resolve it withusing
. Insideusing
you create scope with_container.OpenScope();
. Inside scope you resolve new instance ofServiceC<Strategy>
but you want to reuse some service from parent scope.And now is the issue. Injecting services are not provided from scope. Hovewer if you inject
IResolver
and useResolve
method to createContext
class (which is set in parent scope and pass to child scope)var resolvedContext = resolver.Resolve<Context>();
everything works. But the sameContext
injected via constructor does not have set value.So the problem is that in the
ServiceC<TContext>
constructor (and child classes conctructors) -Context
is not provided from the current scope. Based on the below codeContext
should have Value == "value" inServiceB.Do
method.Code to reproduce:
The text was updated successfully, but these errors were encountered: