You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update "What's new in ASP.NET Core in .NET 10" for .NET 10 RC1 #35994
ASP.NET Core Identity observability has been improved in .NET 10 with metrics. Metrics are counters, histograms and gauges that provide time-series measurements of system or application behavior.
For example, you can use the new ASP.NET Core Identity metrics to observe user management, such as new user creations, password changes and role assignments. And you can use the metrics to observe login/session handling, such as login attempts, sign ins and sign outs, and users using two factor authentication.
The new metrics are in the Microsoft.AspNetCore.Identity meter:
✔️ Resolved — Validation improvements for Blazor and Minimal APIs
Several features and fixes have been added to the new validation API that is coming in .NET 10 for Minimal APIs and Blazor. The RC1 updates are focused on providing feature parity and behavioral compatibility with the existing System.ComponentModel.DataAnnotations.Validator.
Type-level validation attributes
The new validations now support attributes placed on classes and records themselves.
[SumLimit(42)]recordPoint(intX,intY);classSumLimitAttribute(intLimit):ValidationAttribute{protectedoverrideValidationResult?IsValid(object?value,ValidationContext_){if(valueisPointpoint&&point.X+point.Y>Limit){returnnewValidationResult("The sum of X and Y is too high");}returnValidationResult.Success;}}
Skipping validation
A new [SkipValidation] attribute can be used to omit selected properties, parameters, or types from validation. When applied to a property or a method parameter, the validator skips that value during validation. When applied to a type, the validator skips all properties and parameters of that type.
This can be useful, in particular, when using the same model types in cases which require and do not require validation.
Additionally, properties annotated with the [JsonIgnore] attribute are now also omitted from validation to improve consistency between serialization and validation in the context of JSON models. Note that the [SkipValidation] attribute should be preferred in general cases.
Backwards-compatible behavior
Type validation logic has been updated to match the behavior of System.ComponentModel.DataAnnotations.Validator with regards to order of validations and short-circuiting. This means that the following rules are applied when validating an instance of type T:
Member properties of T are validated, including recursively validating nested objects.
Type-level attributes of T are validated.
The IValidatableObject.Validate method is executed, if T implements it.
In case one of these steps produces a validation error, the following steps are skipped.
Model nullable types using oneOf in OpenAPI schema
OpenAPI schema generation for nullable types was improved by using the oneOf pattern instead of the nullable property for complex types and collections. The implementation:
Uses oneOf with null and the actual type schema for nullable complex types in request/response schemas
Implements proper nullability detection for parameters, properties, and return types using reflection and NullabilityInfoContext
Prunes null types from componentized schemas to avoid duplication
Fixes/improvements to schema reference resolution
This release improves the handling of JSON schemas for OpenAPI document generation by properly resolving relative JSON schema references ($ref) in the root schema document.
Include property descriptions as siblings of $ref in OpenAPI schema
Prior to .NET 10, ASP.NET Core discarded descriptions on properties that were defined with $ref in the generated OpenAPI document. This was necessary because OpenAPI v3.0 did not allow sibling properties alongside $ref in schema definitions. But this restriction has been relaxed in OpenAPI 3.1, allowing descriptions to be included alongside $ref. Support was added in RC1 to include property descriptions as siblings of $ref in the generated OpenAPI schema.
This was a community contribution. Thanks @desjoerd!
Add metadata from XML comments on [AsParameters] types to OpenAPI schema
Support has been added for processing XML comments on properties of [AsParameters] parameter classes to extract metadata for use in OpenAPI documentation generation.
Exclude unknown HTTP methods from OpenAPI
OpenAPI schema generation now excludes unknown HTTP methods from the generated OpenAPI document. In particular, query methods, which are standard HTTP methods but not recognized by OpenAPI, are now gracefully excluded from the generated OpenAPI document.
Improve the description of JSON Patch request bodies
The OpenAPI schema generation for JSON Patch operations now correctly applies the application/json-patch+json media type to request bodies that use JSON Patch. This ensures that the generated OpenAPI document accurately reflects the expected media type for JSON Patch operations. In addition, the JSON Patch request body has a detailed schema that describes the structure of the JSON Patch document, including the operations that can be performed.
Use invariant culture for OpenAPI document generation
OpenAPI document generation now uses invariant culture for formatting numbers and dates in the generated OpenAPI document. This ensures that the generated document is consistent and does not vary based on the server's culture settings.
An experimental [SkipValidation] attribute has been added to Microsoft.Extensions.Validation that allows developers to opt out of validation for specific properties, method parameters, or entire types. This provides fine-grained control over validation behavior while maintaining the default validation functionality.
@mikekistler Just note regarding the Skip Validation Attribute paragraph: I am an FTE in the Blazor team so it probably does not count as a community contribution 🙂
@wadepickett@tdykstra ... Because the validation coverage ☝️ applies to Minimal APIs and Blazor, I'm going to place the coverage out in the main What's New article content (not in one of the INCLUDES files). I'll take a shot at getting the reference coverage updated, too. Blazor also has it's own forms validation issue at #35972 that I'll be working at the same time.
I won't address the OpenAPI work for the [SkipValidation] attribute to avoid my Blazor PR colliding with the one coming up for OpenAPI work. Note in passing tho that the [SkipValidation] attribute coverage for OpenAPI is likely for ...
✔️ Resolved — PersistentState support on enhanced navigation
This release introduces fine-grained control over when and how persistent component state (PCS) is restored in Blazor applications, unlocking support for enhanced navigation scenarios. Developers can now configure restoration behavior for properties marked with the [PersistentState] attribute, specifying whether state should be restored during prerendering (initial load), reconnection (resume), or when updates occur as a result of enhanced navigation. The new RestoreBehavior and AllowUpdates options enable scenarios such as restoring state only on initial load, only on resume, or opting-in to receive state updates during enhanced navigation, providing greater flexibility and control over application state management.
This release adds new types and properties: RestoreOptions, RestoreBehavior, RestoreContext, and the RegisterOnRestoring method for programmatic restoration. These allow developers to precisely define restoration logic, avoid unintended overwrites of user state, and support advanced scenarios such as custom restoration flows or partial state updates. For example, a weather forecast component can now persist data and receive updates only during enhanced navigation, while user drafts or settings can be selectively restored on initial load or reconnection, as needed.
Overall, these enhancements make it easier to build robust, stateful Blazor applications that behave predictably across prerendering, reconnection, and client-side navigation events. The result is improved resilience for end-user workflows, better support for advanced navigation patterns, and a more flexible foundation for future Blazor features.
🟢 Example Where AllowUpdates = true Makes Sense
Scenario: Displaying Cached Data That Doesn’t Change Often
Imagine a weather forecast page that fetches data from a service and displays it. The data is read-only and doesn’t change frequently. In this case, allowing updates during enhanced navigation is safe and beneficial—it improves performance and user experience by avoiding unnecessary reloads.
[PersistentState(AllowUpdates = true)]
public WeatherForecast[]? Forecasts { get; set; }
The data is not user-modified.
Updates from enhanced navigation won’t corrupt or overwrite user input.
Improves responsiveness by reusing previously fetched data.
🔴 Example Where AllowUpdates = false Is Preferable
Scenario: User Is Filling Out a Form
Suppose you have a form where users enter sensitive or complex data—like a job application or medical intake form. If enhanced navigation triggers a state update, it could overwrite in-progress user input, causing frustration or data loss.
protected override void OnInitialized()
{
// Load defaults or previously saved draft
FormData = LoadDraft() ?? new ApplicationFormModel();
}
🚫 Why updates are risky:
The user may be actively modifying the form.
Enhanced navigation could restore stale or unintended state.
Preventing updates ensures user input is preserved until explicitly saved.
Activity
JamesNK commentedon Aug 27, 2025
New ASP.NET Core Identity metrics
ASP.NET Core Identity observability has been improved in .NET 10 with metrics. Metrics are counters, histograms and gauges that provide time-series measurements of system or application behavior.
For example, you can use the new ASP.NET Core Identity metrics to observe user management, such as new user creations, password changes and role assignments. And you can use the metrics to observe login/session handling, such as login attempts, sign ins and sign outs, and users using two factor authentication.
The new metrics are in the
Microsoft.AspNetCore.Identitymeter:aspnetcore.identity.user.create.durationaspnetcore.identity.user.update.durationaspnetcore.identity.user.delete.durationaspnetcore.identity.user.check_password_attemptsaspnetcore.identity.user.generated_tokensaspnetcore.identity.user.verify_token_attemptsaspnetcore.identity.sign_in.authenticate.durationaspnetcore.identity.sign_in.check_password_attemptsaspnetcore.identity.sign_in.sign_insaspnetcore.identity.sign_in.sign_outsaspnetcore.identity.sign_in.two_factor_clients_rememberedaspnetcore.identity.sign_in.two_factor_clients_forgottenFor more information about using metrics in ASP.NET Core, see ASP.NET Core metrics.
oroztocil commentedon Aug 28, 2025
✔️ Resolved — Validation improvements for Blazor and Minimal APIs
Several features and fixes have been added to the new validation API that is coming in .NET 10 for Minimal APIs and Blazor. The RC1 updates are focused on providing feature parity and behavioral compatibility with the existing
System.ComponentModel.DataAnnotations.Validator.Type-level validation attributes
The new validations now support attributes placed on classes and records themselves.
Skipping validation
A new
[SkipValidation]attribute can be used to omit selected properties, parameters, or types from validation. When applied to a property or a method parameter, the validator skips that value during validation. When applied to a type, the validator skips all properties and parameters of that type.This can be useful, in particular, when using the same model types in cases which require and do not require validation.
Additionally, properties annotated with the
[JsonIgnore]attribute are now also omitted from validation to improve consistency between serialization and validation in the context of JSON models. Note that the[SkipValidation]attribute should be preferred in general cases.Backwards-compatible behavior
Type validation logic has been updated to match the behavior of
System.ComponentModel.DataAnnotations.Validatorwith regards to order of validations and short-circuiting. This means that the following rules are applied when validating an instance of typeT:Tare validated, including recursively validating nested objects.Tare validated.IValidatableObject.Validatemethod is executed, ifTimplements it.In case one of these steps produces a validation error, the following steps are skipped.
Resolved by #35972.
mikekistler commentedon Sep 4, 2025
Model nullable types using oneOf in OpenAPI schema
OpenAPI schema generation for nullable types was improved by using the
oneOfpattern instead of the nullable property for complex types and collections. The implementation:oneOfwithnulland the actual type schema for nullable complex types in request/response schemasFixes/improvements to schema reference resolution
This release improves the handling of JSON schemas for OpenAPI document generation by properly resolving relative JSON schema references (
$ref) in the root schema document.Include property descriptions as siblings of $ref in OpenAPI schema
Prior to .NET 10, ASP.NET Core discarded descriptions on properties that were defined with
$refin the generated OpenAPI document. This was necessary because OpenAPI v3.0 did not allow sibling properties alongside$refin schema definitions. But this restriction has been relaxed in OpenAPI 3.1, allowing descriptions to be included alongside$ref. Support was added in RC1 to include property descriptions as siblings of$refin the generated OpenAPI schema.This was a community contribution. Thanks @desjoerd!
Add metadata from XML comments on
[AsParameters]types to OpenAPI schemaSupport has been added for processing XML comments on properties of
[AsParameters]parameter classes to extract metadata for use in OpenAPI documentation generation.Exclude unknown HTTP methods from OpenAPI
OpenAPI schema generation now excludes unknown HTTP methods from the generated OpenAPI document. In particular, query methods, which are standard HTTP methods but not recognized by OpenAPI, are now gracefully excluded from the generated OpenAPI document.
This was a community contribution. Thanks @martincostello!
Improve the description of JSON Patch request bodies
The OpenAPI schema generation for JSON Patch operations now correctly applies the
application/json-patch+jsonmedia type to request bodies that use JSON Patch. This ensures that the generated OpenAPI document accurately reflects the expected media type for JSON Patch operations. In addition, the JSON Patch request body has a detailed schema that describes the structure of the JSON Patch document, including the operations that can be performed.This was a community contribution. Thanks @martincostello!
Use invariant culture for OpenAPI document generation
OpenAPI document generation now uses invariant culture for formatting numbers and dates in the generated OpenAPI document. This ensures that the generated document is consistent and does not vary based on the server's culture settings.
This was a community contribution. Thanks @martincostello!
Skip Validation Attribute
An experimental
[SkipValidation]attribute has been added to Microsoft.Extensions.Validation that allows developers to opt out of validation for specific properties, method parameters, or entire types. This provides fine-grained control over validation behavior while maintaining the default validation functionality.oroztocil commentedon Sep 5, 2025
@mikekistler Just note regarding the Skip Validation Attribute paragraph: I am an FTE in the Blazor team so it probably does not count as a community contribution 🙂
guardrex commentedon Sep 5, 2025
@wadepickett @tdykstra ... Because the validation coverage ☝️ applies to Minimal APIs and Blazor, I'm going to place the coverage out in the main What's New article content (not in one of the INCLUDES files). I'll take a shot at getting the reference coverage updated, too. Blazor also has it's own forms validation issue at #35972 that I'll be working at the same time.
I won't address the OpenAPI work for the
[SkipValidation]attribute to avoid my Blazor PR colliding with the one coming up for OpenAPI work. Note in passing tho that the[SkipValidation]attribute coverage for OpenAPI is likely for ...https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/openapi/include-metadata.md
javiercn commentedon Sep 5, 2025
✔️ Resolved — PersistentState support on enhanced navigation
This release introduces fine-grained control over when and how persistent component state (PCS) is restored in Blazor applications, unlocking support for enhanced navigation scenarios. Developers can now configure restoration behavior for properties marked with the
[PersistentState]attribute, specifying whether state should be restored during prerendering (initial load), reconnection (resume), or when updates occur as a result of enhanced navigation. The newRestoreBehaviorandAllowUpdatesoptions enable scenarios such as restoring state only on initial load, only on resume, or opting-in to receive state updates during enhanced navigation, providing greater flexibility and control over application state management.This release adds new types and properties:
RestoreOptions,RestoreBehavior,RestoreContext, and theRegisterOnRestoringmethod for programmatic restoration. These allow developers to precisely define restoration logic, avoid unintended overwrites of user state, and support advanced scenarios such as custom restoration flows or partial state updates. For example, a weather forecast component can now persist data and receive updates only during enhanced navigation, while user drafts or settings can be selectively restored on initial load or reconnection, as needed.Overall, these enhancements make it easier to build robust, stateful Blazor applications that behave predictably across prerendering, reconnection, and client-side navigation events. The result is improved resilience for end-user workflows, better support for advanced navigation patterns, and a more flexible foundation for future Blazor features.
🟢 Example Where AllowUpdates = true Makes Sense
Scenario: Displaying Cached Data That Doesn’t Change Often
Imagine a weather forecast page that fetches data from a service and displays it. The data is read-only and doesn’t change frequently. In this case, allowing updates during enhanced navigation is safe and beneficial—it improves performance and user experience by avoiding unnecessary reloads.
[PersistentState(AllowUpdates = true)]
public WeatherForecast[]? Forecasts { get; set; }
protected override async Task OnInitializedAsync()
{
Forecasts ??= await ForecastService.GetForecastAsync();
}
✅ Why it works:
The data is not user-modified.
Updates from enhanced navigation won’t corrupt or overwrite user input.
Improves responsiveness by reusing previously fetched data.
🔴 Example Where AllowUpdates = false Is Preferable
Scenario: User Is Filling Out a Form
Suppose you have a form where users enter sensitive or complex data—like a job application or medical intake form. If enhanced navigation triggers a state update, it could overwrite in-progress user input, causing frustration or data loss.
[PersistentState(AllowUpdates = false)]
public ApplicationFormModel FormData { get; set; } = new();
protected override void OnInitialized()
{
// Load defaults or previously saved draft
FormData = LoadDraft() ?? new ApplicationFormModel();
}
🚫 Why updates are risky:
The user may be actively modifying the form.
Enhanced navigation could restore stale or unintended state.
Preventing updates ensures user input is preserved until explicitly saved.
Resolved by #36053. Note that I'm using DR's lingo from the .NET Core notes.