Async rule locking up UI thread?

May 15, 2014 at 4:12 PM
Edited May 15, 2014 at 4:12 PM

I've just downloaded the latest version and tried a simple async rule such as below:

Validator.AddAsyncRule(() => Product, () => Task.Factory.StartNew(()=>
                                                                             return RuleResult.Invalid("Wrong produt");
The UI thread remains locked up for 2 seconds. Looks like it's waiting on the Error property to return a result as per below call stack:
WindowsBase.dll!System.Windows.Threading.DispatcherSynchronizationContext.Wait(System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) + 0x29 bytes 
[Native to Managed Transition]  
[Managed to Native Transition]  
MvvmValidation.dll!MvvmValidation.ValidationHelper.GetResultInternal() + 0x70 bytes 
MvvmValidation.dll!MvvmValidation.DataErrorInfoAdapter.Error.get() + 0x10 bytes 
BTW I'm using .NET 4.0 and WPF.

I have also noticed a similar behaviour in the sample app. I start changing the user name to trigger the async validation and sometimes the UI locks up for an instant.

Any suggestions?

May 15, 2014 at 6:22 PM

I have reproduced the problem and will try to fix it as soon as possible.
May 15, 2014 at 6:23 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.