ardalis / ardalis/GuardClauses
[CallerArgumentExpression] parameter should be the last one to allow passing custom message
- Dominant language
- C#
- Stars
- 3.3k
- Forks
- 296
- PR merge metrics
- No merged PRs in 30d
Description
See the guards API below :
````c#
public static int Negative([JetBrainsNotNull] this IGuardClause guardClause,
int input,
[JetBrainsNotNull][JetBrainsInvokerParameterName][CallerArgumentExpression("input")] string? parameterName = null,
string? message = null){
......
}
````
If I want to pass custom message I need to pass `parameterName` as well, which breaks the `CallerArgumentExpression` functionality.
Contributor guide
Research direction
Start by locating the Negative guard in the guards API and review how its optional parameterName and message arguments are exposed. Confirm the intended parameter order and check existing coverage or callers; done means a custom message can be supplied without explicitly passing parameterName while caller-expression behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100