Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Commit ccde910

Browse files
committed
Specify TaskCreationOptions when using TCS
Fixes #8558
1 parent 0b6932d commit ccde910

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorViewCompiler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ private Task<CompiledViewDescriptor> OnCacheMiss(string normalizedPath)
181181
cacheEntryOptions.ExpirationTokens.Add(item.ExpirationTokens[i]);
182182
}
183183

184-
taskSource = new TaskCompletionSource<CompiledViewDescriptor>();
184+
taskSource = new TaskCompletionSource<CompiledViewDescriptor>(creationOptions: TaskCreationOptions.RunContinuationsAsynchronously);
185185
if (item.SupportsCompilation)
186186
{
187187
// We'll compile in just a sec, be patient.

src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/DistributedCacheTagHelperService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public async Task<IHtmlContent> ProcessContentAsync(TagHelperOutput output, Cach
8888
// There is a small race condition here between TryGetValue and TryAdd that might cause the
8989
// content to be computed more than once. We don't care about this race as the probability of
9090
// happening is very small and the impact is not critical.
91-
var tcs = new TaskCompletionSource<IHtmlContent>();
91+
var tcs = new TaskCompletionSource<IHtmlContent>(creationOptions: TaskCreationOptions.RunContinuationsAsynchronously);
9292

9393
_workers.TryAdd(key, tcs.Task);
9494

src/Microsoft.AspNetCore.Mvc.TagHelpers/CacheTagHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private async Task<IHtmlContent> CreateCacheEntry(CacheTagKey cacheKey, TagHelpe
108108
var options = GetMemoryCacheEntryOptions();
109109
options.AddExpirationToken(new CancellationChangeToken(tokenSource.Token));
110110
options.SetSize(PlaceholderSize);
111-
var tcs = new TaskCompletionSource<IHtmlContent>();
111+
var tcs = new TaskCompletionSource<IHtmlContent>(creationOptions: TaskCreationOptions.RunContinuationsAsynchronously);
112112

113113
// The returned value is ignored, we only do this so that
114114
// the compiler doesn't complain about the returned task

0 commit comments

Comments
 (0)