Skip to content

Commit da56563

Browse files
feiyun0112captainsafia
authored andcommitted
[OutputCaching] OutputCacheOptions.ApplicationServices is always null during initialization (#55847)
1 parent a7b7636 commit da56563

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Middleware/OutputCaching/src/OutputCacheServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public static IServiceCollection AddOutputCache(this IServiceCollection services
5050
ArgumentNullException.ThrowIfNull(services);
5151
ArgumentNullException.ThrowIfNull(configureOptions);
5252

53-
services.Configure(configureOptions);
5453
services.AddOutputCache();
54+
services.Configure(configureOptions);
5555

5656
return services;
5757
}

src/Middleware/OutputCaching/test/TestUtils.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ private static IEnumerable<IHostBuilder> CreateBuildersWithOutputCaching(
159159
{
160160
services.AddOutputCache(outputCachingOptions =>
161161
{
162+
Assert.NotNull(outputCachingOptions.ApplicationServices);
162163
if (options != null)
163164
{
164165
outputCachingOptions.MaximumBodySize = options.MaximumBodySize;

0 commit comments

Comments
 (0)