Skip to content

What's New 11 p1: Add IOutputCachePolicyProvider, TimeProvider, Auto-trust #36759

@wadepickett

Description

@wadepickett

The following items from the release notes at: dotnet/core#10222

Framework/API:

IOutputCachePolicyProvider: dotnet/aspnetcore#64455
TimeProvider in Identity: dotnet/aspnetcore#63042

Developer Experience:

Auto-trust dev cert in WSL: dotnet/aspnetcore#64966

Need to be addressed in the ASP.NET Core What's new topic here:
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/release-notes/aspnetcore-11.md

With this content from the release notes (check for latest) added through a new include file:

Framework/API:

IOutputCachePolicyProvider

ASP.NET Core now provides the IOutputCachePolicyProvider interface for implementing custom output caching policy selection logic. This interface allows applications to determine the default base caching policy, check for the existence of named policies, and support advanced scenarios where policies must be resolved dynamically. Examples include loading policies from external configuration sources, databases, or applying tenant‑specific caching rules.

public interface IOutputCachePolicyProvider
{
    IReadOnlyList<IOutputCachePolicy> GetBasePolicies();
    ValueTask<IOutputCachePolicy?> GetPolicyAsync(string policyName);
}

Thank you @lqlive for this contribution!

TimeProvider in ASP.NET Core Identity

ASP.NET Core Identity now uses TimeProvider instead of DateTime and DateTimeOffset for all time-related operations. This makes Identity components more testable and enables better control over time in tests and specialized scenarios.

// In tests
var fakeTimeProvider = new FakeTimeProvider(
    new DateTimeOffset(2024, 1, 1, 0, 0, 0, TimeSpan.Zero));

services.AddSingleton<TimeProvider>(fakeTimeProvider);
services.AddIdentity<IdentityUser, IdentityRole>();

// Identity will now use the fake time provider

Using TimeProvider makes it easier to write deterministic tests for time-sensitive Identity features like token expiration, lockout durations, and security stamp validation.

Developer Experience

Auto-trust development certificates in WSL

The development certificate setup now automatically trusts certificates in WSL (Windows Subsystem for Linux) environments. When running dotnet dev-certs https --trust in WSL, the certificate is automatically installed and trusted in both the WSL environment and Windows, eliminating manual trust configuration.

# Automatically trusts certificates in both WSL and Windows
dotnet dev-certs https --trust

This improvement streamlines the development experience when using WSL, removing a common friction point for developers working in Linux environments on Windows.

Thank you @StickFun for this contribution!


Associated WorkItem - 554207

Metadata

Metadata

Assignees

Labels

seQUESTeredIdentifies that an issue has been imported into Quest.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions