Feb 15, 2010 at 9:12 AM
Edited Feb 15, 2010 at 10:26 AM
I am adding a [NotNullOrEmpty] attribute to a property of an inherited class.
On validation the message shows twice (The exception is thrown twice).
Does any one have an idea of why could this be happening? Has anyone seen this before?
I looked into the source code to see if it is problem when using derived classes. I updated the TestNotNullOrEmptyAttribute to use a 'DerivedDummy', and subjected my validation test on that object. And yes, the message comes up twice. So this seems to be
the issue. The validation function is called on the Derived as well as the Inherited class; which is why the properties in the inherited class are validated twice.
I am not a C# expert, so will take to debug into the source code and find a solution. Till then if any one has an update on this, please share.