Skip to content

[release/11.0] Fix Blazor client-side validation support for custom attributes - #69026

Merged
lewing merged 1 commit into
release/11.0from
backport/pr-69020-to-release/11.0
Sep 4, 2026
Merged

[release/11.0] Fix Blazor client-side validation support for custom attributes#69026
lewing merged 1 commit into
release/11.0from
backport/pr-69020-to-release/11.0

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Backport of #69020 to release/11.0

/cc @oroztocil

Fixes two problems in support for custom validation attributes in the Blazor SSR client-side validation feature.

Description

In .NET 11, we are adding a client-side validation feature for statically rendered Blazor forms. This feature allows static Blazor forms to give immediate validation feedback as the user is typing (i.e. without a full form submit). This is backed up by validation rules which are rendered into page based on .NET validation attributes and later enforced by JS code on the client.

The initial Preview release of the feature contains two problems in how user-defined validation attributes are supported:

  1. The JS service that backs up the API for adding custom validators is initialized in a way that makes it hard or impossible to use the API in places where users would typically want to.
  2. The .NET logic for emitting validation rule metadata into the page does not work properly with user-defined validation attributes in case where the custom attribute is derived from a built-in one (e.g. [Required]). This is a common scenario which needs to be supported.

Customer Impact

Without this fix, a new user-facing validation feature is incomplete or unnecessarily difficult to use with user-defined validation attributes. This would decrease the usefulness of the feature, and could be seen as a regression compared to a similar feature previously available in MVC, blocking MVC users from migrating to Blazor SSR.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Two small fixes for a completely new feature.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

* Fix Blazor client-side validation initialization to better support custom validator registration

* Try IClientValidationRuleProvider first in client validation rule generation to support derived built-in attributes
@github-actions
github-actions Bot requested a review from a team as a code owner September 3, 2026 14:51
@Youssef1313 Youssef1313 added the Servicing-consider Shiproom approval is required for the issue label Sep 3, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @github-actions[bot]. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge.

To learn more about how to prepare a servicing PR click here.

@oroztocil oroztocil added this to the 11.0-rc2 milestone Sep 3, 2026
@oroztocil oroztocil added the area-blazor Includes: Blazor, Razor Components label Sep 3, 2026
@kotlarmilos
kotlarmilos self-requested a review September 4, 2026 09:29
@kotlarmilos kotlarmilos added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Sep 4, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @github-actions[bot]. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed.

@lewing
lewing merged commit 8b2331c into release/11.0 Sep 4, 2026
51 checks passed
@lewing
lewing deleted the backport/pr-69020-to-release/11.0 branch September 4, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants