-
-
Notifications
You must be signed in to change notification settings - Fork 279
Closed
Description
- .NET SDK Version: 6.0.101
Discussed in #167
Description: It seems that in some cases, Guard clauses throw Argument exceptions without "paramName" parameter being set.
Steps to Reproduce:
- Use Ardalis.GuardClauses 3.3.0 NuGet Package.
- Ensure that Guard.Against.Null is invoked with 3 parameters set: input, parameterName, and message. Input must be null.
- Examine the exception thrown by the Guard clause and check the ParamName property.
- The Param.Name property will be Null, even though the "parameterName" parameter of the Guard clause has been set.
Further details:
This described situation occurs when using some of the Guard clauses with the custom message set. Without the custom message, everything is expected. Guard clauses affected by this are:
- Null
- OutOfRange (general)
- OutOfRange (enum)
- OutOfRange (enumerable)
The next .net fiddle has a sample code that demonstrate the issue in all mentioned cases: https://dotnetfiddle.net/3PzcIQ
Metadata
Metadata
Assignees
Labels
No labels