WCF VAB and ref parameters

Topics: Validation Application Block
May 25, 2010 at 7:27 PM

Hello...i'm using EL 5.0 and i have a wcf operation that takes a ref parameter...

void Test(ref MyClass obj);

If I set the [ValidationBehavior] on my service I get an exception when the service host opens.

It comes down to file ValidationFactory.cs and method ...

        protected virtual Validator WrapAndInstrumentValidator(Validator validator, Type type)



var validatorWrapperType = typeof(GenericValidatorWrapper<>).MakeGenericType(type);


The MakeGenericType won't work with ref or out parameters.  I believe this should probably use GetElementType.

Is this by design?  or should this work and i'm doing something wrong?



May 26, 2010 at 7:50 AM

Not sure if this is by design or a bug, we'll confirm this with the entlib team.

May 26, 2010 at 5:05 PM

Thanks...please let us know as soon as you can!

May 28, 2010 at 10:33 PM

Is there any update on this?  it basically renders the vab useless.


May 31, 2010 at 2:25 AM

No updates yet.  IMHO, this indeed looks like a bug since I can't repro the error on v4.1.


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

Jun 1, 2010 at 3:13 PM

were you able to repro with 5.0?


Jun 2, 2010 at 1:29 AM

Yes I did.


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

Jun 8, 2010 at 4:00 PM

I assume that there will not be a fix for this in 5.0?  We are working on a huge app that was going to use the vab for validation.


Jun 23, 2010 at 8:52 PM

is there anyway to get an update on this?  whether or not there is a plan to fix this?

Jun 24, 2010 at 12:38 AM

JSojourn, hello

Based on the lack of interest from other customers and the fact this scenario was out of scope for Enterprise Library 5.0, currently we do not have plans to release a fix.

Your options are to :

  1. not use [ref] parameters on a WCF service as the recommended practice is actually to use explicit input and output messages for your operations
  2. modify source code of Enteprise Library to suit your needs


Jun 28, 2010 at 5:22 PM
Thanks for the response... I do totally disagree with the decision though. This is not an edge case. The entire VAB does not work for ref parameters OR out parameters, therefore your suggestion #1 is invalid. Who doesn't use out parameters....how can this not be affecting other people? Unfortunately for #2, I have never been able to successfully build the source nor has anyone I know. But thanks for looking into it. We will probably go back to 4.1.