Gerry,
The final verdict after hours of debugging I have found that the Validators
are never called.  I have put breakpoints in all of them and ran scripts
that contained tasks that had all of the validators defined for them.  Not
one break point was ever hit.

The following line in the element.cs file seems to be the one that throws an
exception when value does not match the return value of the method.

if (propertyType.IsSubclassOf(Type.GetType("System.Enum"))) {
        try {
        paramaters[0] = Enum.Parse(propertyType, attrValue);
      } catch (Exception) {
            // catch type conversion exceptions here
            string message = "Invalid value \"" + attrValue + "\". Valid
values for this attribute are: ";
            foreach (object value in Enum.GetValues(propertyType)) {
                message += value.ToString() + ", ";
      }
      // strip last ,
      message = message.Substring(0, message.Length - 2);
      throw new BuildException(message, Location);
      }
      } else {
 
//**************************************************************************
***
                // This is the line that causes the exception to be thrown
if they don't match
        
//**************************************************************************
***
                paramaters[0] = Convert.ChangeType(attrValue,
propertyInfo.PropertyType);
      }
      info.Invoke(this, paramaters);
}

I also removed all of the Validator lines from a few of the tasks and run my
test scripts against them with errors in the value type of the attributes.
I got the same exceptions with them or without them. So I ask all of you out
there, why do these exist if they are not being used?

Christopher Barkley

-----Original Message-----
From: Shaw, Gerry [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 8:49 PM
To: Barkley, Chris; [EMAIL PROTECTED]
Subject: RE: [nant-dev] Adding Validators


> Do I need to update 
> any files to tell it that this new validator?

To be honest Chris I don't know.  I suggest you set a breakpoint on the
BooleanValidator code and trace through it.  I believe the code is in
the Element.cs that will be of interest.

Feel free to comment the BuildAttributeAttribute.cs class so the next
person doesn't go through your pain with any info you find.

> Thanks for your help.
Thanks for yours.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to