See:
|
throw new ArgumentException($"'{nameof(fieldName)}' cannot be null or empty", nameof(fieldName)); |
The name of the fieldName argument is added to the exception message, whereas the argument being checked here is actually the fieldValue. Hence, if you specify a null-or-empty fieldValue, you get a rather confusing exception that mentions the wrong argument.