-
Notifications
You must be signed in to change notification settings - Fork 318
Avoid race when scopeValidation is enabled #470
Conversation
|
||
public void ValidateCallSite(Type serviceType, IServiceCallSite callSite) | ||
{ | ||
var scoped = VisitCallSite(callSite, default(CallSiteValidatorState)); | ||
if (scoped != null) | ||
{ | ||
_scopedServices.Add(serviceType, scoped); | ||
_scopedServices[serviceType] = scoped; |
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.
Is it correct to update the value if the key already exists? Or would it be more correct to use TryAdd()
, so the value is not updated if the key already exists? Or does it not matter and either would be equally correct?
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.
We are displaying only one scoped service of multiple possible so I don't think there is a difference which one exactly.
/cc @Eilon @DamianEdwards should this go into 1.1.x? |
I don't know if there's any runway left for 1.1.1. @Eilon? |
Both a pro and con of merging this is that scopeValidation is opt-in. Presumably not many people are calling |
The problem is that there's no workaround if you do want to use it. That kinda bug IMO classifies as patchable. 1.1.2 maybe? |
Yeah I think it should be considered. I think it'll have to wait for 1.1.2 though |
Too late for the current patch, for sure. Can someone log a new bug for DI's next milestone so that we can consider? Please include some reasonable justification in terms of customer scenario. |
Fixes: #467
@halter73 @mikeharder