Skip to content
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

Child service provider should create parent "scope" to resolve from parent #23

Closed
dazinator opened this issue Jan 31, 2021 · 0 comments
Closed

Comments

@dazinator
Copy link
Owner

dazinator commented Jan 31, 2021

The Child Service Provider in some situations, uses the parent service provider to resolve certain services.

The problem is, if the parent service provider is disposed, the child service provider will start erroring in these cases.

The solution to this, is to make the Child Service Provider obtain a new Scope from the parent service provider, and to use this parent service provider's Scope to do the resolution in. When you Dispose of the parent service provider, this will break it's scopes (potentially) so this in and of itself won't fix the problem - however, with the advent of #19 you can use a scope tracking service provider as the parent service provider, which will wait for all of its scopes to dispose before it disposes. This means:

  1. If you attempt to dispose async the parent scope tracking service provider ScopeTrackingServiceProvider #19 and you have a child service provider derived from it, that child service provider will now be consuming a scope - so the parent scope tracking service provider ScopeTrackingServiceProvider #19 will not dispose until that scope has been released. This basically means it won't dispose until the child service provider has first been disposed which will fix various issues that may otherwise occur.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant