-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Disposing scopes more than once should work #50852
Conversation
- Recently introduced a regression where disposing DI scopes multiple times throws.
Tagging subscribers to this area: @eerhardt, @maryamariyan Issue Details
See dotnet/aspnetcore#31576 where this was found.
|
@@ -176,6 +176,12 @@ private void ClearState() | |||
// try to return to the pool while somebody is trying to access ResolvedServices. | |||
lock (_scopeLock) | |||
{ | |||
// Don't attempt to dispose if we're already disposed | |||
if (_state == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could also check _disposed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we only set _state to null below if Return returns true? We don't want to always null it out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super weird edge case around root scopes vs child scopes #50463 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add the comment to the code, so we remember next time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, it also doesn't get nulled out when the pool is full.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's in the comment below this statement.
This is why we need nullability checks on 😄 |
What's the deal with the CI, is it on fire? |
/azp run runtime |
/azp run runtime-staging |
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run dotnet-linker-tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-dev-innerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
Merging this one as I re-ran 5 times and the legs seem to be on 🔥 . This is blocking asp.net core grabbing new deps. |
See dotnet/aspnetcore#31576 where this was found.