Fix #8451
Change tokens can call into your code IMMEDIATELY when you subscribe. I reviewed our other usage of ChangeToken.OnChange in MVC and everything looks good.
This commit is contained in:
parent
cb88e906b2
commit
35597db277
|
|
@ -33,11 +33,12 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
|||
|
||||
_actionDescriptorChangeProviders = actionDescriptorChangeProviders.ToArray();
|
||||
|
||||
_lock = new object();
|
||||
|
||||
// IMPORTANT: this needs to be the last thing we do in the constructor. Change notifications can happen immediately!
|
||||
ChangeToken.OnChange(
|
||||
GetCompositeChangeToken,
|
||||
UpdateCollection);
|
||||
|
||||
_lock = new object();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
|||
|
||||
ConventionalEndpointInfos = new List<MvcEndpointInfo>();
|
||||
|
||||
// IMPORTANT: this needs to be the last thing we do in the constructor. Change notifications can happen immediately!
|
||||
//
|
||||
// It's possible for someone to override the collection provider without providing
|
||||
// change notifications. If that's the case we won't process changes.
|
||||
if (actions is ActionDescriptorCollectionProvider collectionProviderWithChangeToken)
|
||||
|
|
|
|||
Loading…
Reference in New Issue