Validation Block - WCF Integration

Topics: Validation Application Block
Jul 1, 2007 at 1:59 PM

I am not able to get the Validation block working with WCF async operations. It throws an Exception and fails the Service hosting. VAB checks for OperationDescription.SyncMethod, which is null in case of async operation.
Is this not supported OR I am doing something wrong.

Jul 3, 2007 at 2:57 PM

I'm afraid the async scenario is not supported. However, can you provide additional details about the issue you're facing (which exception is thrown, what do your service and operation contracts look like) so it can be properly diagnosed?

Jul 5, 2007 at 5:59 AM
1. ValidationBehavior.cs
HasValidationAssertions() has not null check for
MethodInfo methodInfo = operation.SyncMethod; //this is null in Async method

2. ValidationParameterInspector.cs
public constructor also checks for MethodInfo methodInfo = operation.SyncMethod;

After these 2 changes it worked fine.

Jul 8, 2007 at 4:28 PM
Forgot to mention
ValidationParameterInspector should not consider last 2 parameters of operation call as in Async they are AsyncCallback and state; otherwise BeforeCall throws an indexoutofrangeexception.