Contract.Requires for array shouldn't checks its length, just for null.
Actual
C#Contract.Requires(items != null && items.Length != 0, nameof(items) + " is null or empty.");
Expected
C#Contract.Requires(items != null , nameof(items) + " is null.");
Mostly it is not an error passing an empty array. IMHO.
Hi Miha,
I totally agree with you that in case of the Contract.Requires code contract, it's not necessary to check the array length. However, we will keep such a check for the Exit Method and other contracts.
Hi Alex,
Hm, don't know about Exit either. Empty array can be perfectly valid result as well.
Miha,
Since CodeRush Classic, we use not only null checks but also check if array/collections/strings are not empty. It's a matter of personal style, so the best decision would be to add options so everyone would have the preferred result.