We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reproducible: Use DataAnnotation for example in a WPF Project.
The Method ValidateProperties will always return true, because the linq query result is empty.
var propertiesToValidate = _entityToValidate.GetType() .GetRuntimeProperties() .Where(c => c.GetCustomAttributes(typeof(ValidationAttribute)).Any());
Because the type of the DataAnnotation from the wpf project differs from the type typeof(ValidationAttribute) of the PCL project which are not equal:
typeof(ValidationAttribute)
wpf type _entityToValidate.GetType().GetRuntimeProperties().ElementAt(1).GetCustomAttributes().FirstOrDefault().GetType().AssemblyQualifiedName = "System.ComponentModel.DataAnnotations.RequiredAttribute, System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" pcl type typeof(ValidationAttribute).AssemblyQualifiedName = System.ComponentModel.DataAnnotations.ValidationAttribute, Portable.DataAnnotations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6f21be3d5ccff8cd
_entityToValidate.GetType().GetRuntimeProperties().ElementAt(1).GetCustomAttributes().FirstOrDefault().GetType().AssemblyQualifiedName
"System.ComponentModel.DataAnnotations.RequiredAttribute, System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
typeof(ValidationAttribute).AssemblyQualifiedName
System.ComponentModel.DataAnnotations.ValidationAttribute, Portable.DataAnnotations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6f21be3d5ccff8cd
Possible solution: Type comparison using Strings (e.g. Type.Name)
The text was updated successfully, but these errors were encountered:
Changed Type to String comparison . Anyway validation evaluates to true. Needs to be more investigated.
Sorry, something went wrong.
Fixed with b2f5c53
No branches or pull requests
reproducible:
Use DataAnnotation for example in a WPF Project.
The Method ValidateProperties will always return true, because the linq query result is empty.
Because the type of the DataAnnotation from the wpf project differs from the type
typeof(ValidationAttribute)
of the PCL project which are not equal:wpf type
_entityToValidate.GetType().GetRuntimeProperties().ElementAt(1).GetCustomAttributes().FirstOrDefault().GetType().AssemblyQualifiedName
="System.ComponentModel.DataAnnotations.RequiredAttribute, System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
pcl type
typeof(ValidationAttribute).AssemblyQualifiedName
=System.ComponentModel.DataAnnotations.ValidationAttribute, Portable.DataAnnotations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6f21be3d5ccff8cd
Possible solution: Type comparison using Strings (e.g. Type.Name)
The text was updated successfully, but these errors were encountered: