We are as a team working on a project which currently using WCF as in between client and server.

All business rules are written on managers classes which are used by service so its means no validation rule will be on client side (for example duplicate user name )

so far in case of duplicate user name validation fails we throw faultException from service and use those fault Exceptions can be used by client to check why that operation is failed.

Now my manager wants that we should not use faultException. he has following points

  1. Exception throwing for validation messages is not a good approach.
  2. EXception throw and catch take more time .
  3. Everytime client must have to check faultException catch block before any other catch block

so he gave us idea to implement the methods of service with an extra parameter which will be ref type of error class object . any validation rule will be added to that ref type and client will check that ref first and if any error client can show validation message.

so my questions are

  1. really using faultException for business rules validation is bad practice ?
  2. what are cons of using ref varibales as parameter in service operation contracts ?
  3. What will be better approach if any other normally uses in programming world ?

1 Answer 1


what are cons of using ref varibales as parameter in service operation contracts ?

I first wrote: "The major con is that this does not work. Period. You need another approach." It seems that that's not correct, as long as you don't leave the .NET environment, it seems to work. However, ref parameters are considered bad practice even in normal code by Microsoft. Lengthy explanation here. There simply is no need to have ref or out parameters.

I would expect a validation to return it's result. As a return value or if more information is required as a class encapsulating return values and error messages.

If the validation itself could not be processed (like you check against a database but the database was not available) then I would indeed expect an exception.

Not the answer you're looking for? Browse other questions tagged or ask your own question.