-
-
Notifications
You must be signed in to change notification settings - Fork 365
Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
当标记了自定义的必填验证,如代码中的 AzRequiredCustomAttribute 类,并且 ErrorMessage 的描述中包含自定义的插入占位标记{{Value}}。
[Display(Name = "父菜单")]
[AzRequiredCustom(typeof(VO), nameof(ValidParentId), ErrorMessage = $"当前 {{Value}} 的值必须要设置 {{0}} 。")]
public long Value { get; set; } = 1;在 AzRequiredCustomAttribute 验证通过后【满足验证规则】,到达 RequiredValidator 时,因为 List<ValidationResult> 集合为空,所以其会做兜底验证。
但其在验证之前会先将 ErrorMessage 的内容进行格式处理,因为自定义的 ErrorMessage 中包含不符合 string.Format 的内容,所以在格式化时会引发异常。
Expected Behavior
调整 RequiredValidator 类在验证时的本地化代码执行时机。
Interactive render mode
Interactive Server (Interactive server-side rendering (interactive SSR) using Blazor Server)
Steps To Reproduce
调整首页中的 SelectTree 组件值为其他有效值,就可复现异常。
Exceptions (if any)
No response
.NET Version
NET8.0
Anything else?
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working