Range validator - One or more validation errors occured when saving app.config

Topics: Validation Application Block
Aug 4, 2008 at 3:22 PM
Edited Aug 4, 2008 at 3:23 PM
Just ran across this.  I am adding the following Range Validator via the GUI designer:

<validator lowerBound="50" lowerBoundType="Inclusive" upperBound="499"

upperBoundType="Inclusive" negated="false" messageTemplate="Weight must be between 50 and 499."

messageTemplateResourceName="" messageTemplateResourceType=""

tag="Subject.Height" type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeValidator, Microsoft.Practices.EnterpriseLibrary.Validation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

name="Weight Range Validator" />

 

When I try to save I get the message "One or more validation errors occured" and it flags this validator with the message the value for upperBound must be greater than lowerBound.   To get around it I have to actually specify the lowerBound as 050 instead of just 50.  Last time I checked I thought 50 was less than 499 but maybe I'm going crazy!

I have a work around so it is not critical but I wanted to let the dev team know just in case someone else hits it.

Aug 4, 2008 at 3:32 PM
Hi,

Thanks for the update. This is a known issue; the configuration validation performs a string comparison, which is of course not very useful in this case. The work around you've described is adequate.

Regards,
Fernando