Specify TaskCreationOptions when using TCS
Fixes https://github.com/aspnet/Mvc/issues/8558
This commit is contained in:
parent
0b6932dc15
commit
ccde910b29
|
|
@ -181,7 +181,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
|
|||
cacheEntryOptions.ExpirationTokens.Add(item.ExpirationTokens[i]);
|
||||
}
|
||||
|
||||
taskSource = new TaskCompletionSource<CompiledViewDescriptor>();
|
||||
taskSource = new TaskCompletionSource<CompiledViewDescriptor>(creationOptions: TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
if (item.SupportsCompilation)
|
||||
{
|
||||
// We'll compile in just a sec, be patient.
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers.Cache
|
|||
// There is a small race condition here between TryGetValue and TryAdd that might cause the
|
||||
// content to be computed more than once. We don't care about this race as the probability of
|
||||
// happening is very small and the impact is not critical.
|
||||
var tcs = new TaskCompletionSource<IHtmlContent>();
|
||||
var tcs = new TaskCompletionSource<IHtmlContent>(creationOptions: TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
|
||||
_workers.TryAdd(key, tcs.Task);
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
|
|||
var options = GetMemoryCacheEntryOptions();
|
||||
options.AddExpirationToken(new CancellationChangeToken(tokenSource.Token));
|
||||
options.SetSize(PlaceholderSize);
|
||||
var tcs = new TaskCompletionSource<IHtmlContent>();
|
||||
var tcs = new TaskCompletionSource<IHtmlContent>(creationOptions: TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
|
||||
// The returned value is ignored, we only do this so that
|
||||
// the compiler doesn't complain about the returned task
|
||||
|
|
|
|||
Loading…
Reference in New Issue