private static void ValidateDynamicArgument(Expression arg, string paramName, int index)
{
ExpressionUtils.RequiresCanRead(arg, paramName, index);
var type = arg.Type;
ContractUtils.RequiresNotNull(type, nameof(type));
TypeUtils.ValidateType(type, nameof(type));
if (type == typeof(void))
{
throw Error.ArgumentTypeCannotBeVoid();
}
}