diff --git a/src/Mvc/Mvc.TagHelpers/src/CacheTagHelperMemoryCacheFactory.cs b/src/Mvc/Mvc.TagHelpers/src/CacheTagHelperMemoryCacheFactory.cs index 0b69b2a974a7..0546e53a3a9f 100644 --- a/src/Mvc/Mvc.TagHelpers/src/CacheTagHelperMemoryCacheFactory.cs +++ b/src/Mvc/Mvc.TagHelpers/src/CacheTagHelperMemoryCacheFactory.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Extensions.Caching.Memory; @@ -20,7 +20,8 @@ public CacheTagHelperMemoryCacheFactory(IOptions options) { Cache = new MemoryCache(new MemoryCacheOptions { - SizeLimit = options.Value.SizeLimit + SizeLimit = options.Value.SizeLimit, + TrackLinkedCacheEntries = true, }); } diff --git a/src/Mvc/Mvc.TagHelpers/test/CacheTagHelperTest.cs b/src/Mvc/Mvc.TagHelpers/test/CacheTagHelperTest.cs index 8ac0e6bfbfc2..6b7a35a69b14 100644 --- a/src/Mvc/Mvc.TagHelpers/test/CacheTagHelperTest.cs +++ b/src/Mvc/Mvc.TagHelpers/test/CacheTagHelperTest.cs @@ -485,7 +485,6 @@ public async Task ProcessAsync_UsesExpiresSliding_ToExpireCacheEntryWithSlidingE } [Fact] - [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/36765")] public async Task ProcessAsync_FlowsEntryLinkThatAllowsAddingTriggersToAddedEntry() { // Arrange @@ -493,7 +492,7 @@ public async Task ProcessAsync_FlowsEntryLinkThatAllowsAddingTriggersToAddedEntr var expectedContent = new DefaultTagHelperContent(); expectedContent.SetContent("some-content"); var tokenSource = new CancellationTokenSource(); - var cache = new MemoryCache(new MemoryCacheOptions()); + var cache = new MemoryCache(new MemoryCacheOptions() { TrackLinkedCacheEntries = true }); var cacheEntryOptions = new MemoryCacheEntryOptions() .AddExpirationToken(new CancellationChangeToken(tokenSource.Token)); var tagHelperContext = new TagHelperContext( diff --git a/src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationTest.cs b/src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationTest.cs index 9e5f29b7cf62..8262a7820b2d 100644 --- a/src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationTest.cs +++ b/src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationTest.cs @@ -526,7 +526,6 @@ public async Task CacheTagHelper_VariesByUserId() } [Fact] - [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/36765")] public async Task CacheTagHelper_BubblesExpirationOfNestedTagHelpers() { // Arrange & Act - 1 diff --git a/src/Mvc/test/WebSites/HtmlGenerationWebSite/Startup.cs b/src/Mvc/test/WebSites/HtmlGenerationWebSite/Startup.cs index 2823a649cc5c..f283a519c813 100644 --- a/src/Mvc/test/WebSites/HtmlGenerationWebSite/Startup.cs +++ b/src/Mvc/test/WebSites/HtmlGenerationWebSite/Startup.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.TagHelpers; +using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.DependencyInjection; namespace HtmlGenerationWebSite; @@ -22,6 +23,7 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(typeof(ISignalTokenProviderService<>), typeof(SignalTokenProviderService<>)); services.AddSingleton(); + services.Configure(o => o.TrackLinkedCacheEntries = true); } public virtual void Configure(IApplicationBuilder app)