With the latest Aspose.Words for .NET 20.6,
Let’s use the example here
You have chosen <<if [!items.Any()]>>no items<><<[items.Count()]>> item(s)<>.
If I changed to this one, assume items = 
(ignore extra spaces)
<<foreach [item in items]>><<[item.attributeName]>><< /foreach >>
<< else >>
<< /if >>
it will fail with this error
System.InvalidOperationException: ‘An error has been encountered at the end of expression ‘item.attributeName]>’. Can not get the value of member ‘attributeName’ on type ‘System.Data.DataRow’.’
It looks that, even the array is empty, the report engine still goes to do the evaluation of attribute name first.
Thanks for any help.