Random long runing validation

Jan 12, 2015 at 12:51 PM
Edited Jan 12, 2015 at 12:55 PM
I have a problem with validation in WPF 4.5.1 application. I’m executing ValidateAll on object graph with validation rules on main object with some child collection to validate (in sum 150 validation to calculate on all objects). On random occasions (especially first one) validation takes long time (up to 40 seconds) – I have add measured each rule with Stopwatch and each rule is executing shorter than 1ms (it is only in memory if/linq check) and in sum it takes no more than 100ms (when calculating sum of execution of each rule). When I instrumented app I saw that most of time it waits in

var isCompleted = completedEvent.WaitOne(AsyncRuleExecutionTimeout);

and sometimes even throws timeout exception.

Additionally when I’m compering start time of each rule (I have loged timings in database) I can see that there is some bunch of rules executing in small time window and after that is a couple of seconds window and another bunch of rules executing. It looks like there is some problem with locking/waiting. Is this a known problem? Besides this when executing validation next time it can take 100ms or 40s.
Jan 12, 2015 at 7:50 PM

Do you have the latest version of the library? Could you download the latest version from here and try it? The issue you're describing could have been fixed as part of the following bug: https://mvvmvalidation.codeplex.com/workitem/7.
Jan 12, 2015 at 8:12 PM
I think I have last sources – when error was detected I downloaded sources and replaced nuget packet. I also checked attached dll and problem still exists. Maybe I’m doing something wrong but I can imagine where this random behavior came from?
Jan 12, 2015 at 8:20 PM
OK, I will try to reproduce it on my side to see what's going on. Unfortunately I don't have much time at this moment. I will try to do it over the weekend. Sorry for the inconvenience.
Jan 12, 2015 at 8:39 PM
I also have little time to dig into problem - live is live ;) To be more precisely problem is visible in my project when objects in collection validated by AddChildValidatableCollection grows to about 60 (internally those object also have validated collection but those have mostly one to two elements).
Jan 23, 2015 at 12:53 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.