WCF general response validation for multiple services
Peter - a couple of observations:


Since you say "Each response object from the service inherits from a base class ResponseBase" the gut reaction is to just use ResponseBase and let the inheritance model in C# handle everything. As you go on to explain, however, ResponseBase is not really the same base class across services, as they vary from service to service with generated code. In this case, you know exactly what the shape of the object is, but don't know its type. This is an example of 'duck typing' - if it looks like a duck, walks like a duck, and quacks like a duck, then we might as well treat it like a duck. This is exactly what dynamic typing is good for and seems to me an excellent use of this feature of C# 4.0.
The two exception conditions in your code are not created equal. The first seems to flag an incorrect use of the method, while the second is the method doing its job. So consider replacing the first one with a Code Contract if you are on .NET 4. (See Dino Esposito's articles in MSDN Magazine - 3 months in a row - for a good overview, starting here. Note especially that Code Contracts can be turned off for runtime, and they may be off already in your project. See Dino's articles for an explanation.)


Here is pseudocode:

public static void VerifyResponse(dynamic response) 
{
   Contract.Requires(response != null);
   // or perhaps: Contract.Requires&lt;ArgumentNullException&gt;(response != null, "response");
   // or: if (response == null) throw new ArgumentNullException("response"); 

   if (response.ErrorCode &lt; 0) 
      throw new InvalidServiceResponseException(response.ErrorCode, response.ErrorMessage); 
}