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
I encountered a bug in "AbpModelMetadataProvider" where a System.InvalidOperationException is thrown with the following error message: "Either ErrorMessageString or ErrorMessageResourceName must be set, but not both."
This exception occurs when i use validation error messages from ResourceFile (.resx) on my DTOs
Reproduction Steps
Configure Dto validation like this
class DepartmentDto
{
[Required(AllowEmptyStrings = false, ErrorMessageResourceType = typeof(Configuration_DepartmentResource), ErrorMessageResourceName = "DepartmentNameRequired")]
public string DepartmentName { get; set; }
}
When Model validation triggers for this class you will get the exception
Expected behavior
Validator should use error message from resource
Actual behavior
Validator is only checking for ErrorMessage and if null tries to set default error message
Regression?
No response
Known Workarounds
Override AbpModelMetadataProvider and change NormalizeValidationAttrbute function to check for "ErrorMessageResourceName" also not just the ErrorMessage
Example:
Is there an existing issue for this?
Description
I encountered a bug in "AbpModelMetadataProvider" where a System.InvalidOperationException is thrown with the following error message: "Either ErrorMessageString or ErrorMessageResourceName must be set, but not both."
This exception occurs when i use validation error messages from ResourceFile (.resx) on my DTOs
Reproduction Steps
Configure Dto validation like this
When Model validation triggers for this class you will get the exception
Expected behavior
Validator should use error message from resource
Actual behavior
Validator is only checking for ErrorMessage and if null tries to set default error message
Regression?
No response
Known Workarounds
Override AbpModelMetadataProvider and change NormalizeValidationAttrbute function to check for "ErrorMessageResourceName" also not just the ErrorMessage
Example:
Version
7.x
User Interface
Common (Default)
Database Provider
EF Core (Default)
Tiered or separate authentication server
None (Default)
Operation System
Windows (Default)
Other information
No response
The text was updated successfully, but these errors were encountered: