Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullOrEmpty or NullOrWhiteSpace ignore the custom message when the input is null #174

Closed
Miljankg opened this issue Jan 6, 2022 · 0 comments · Fixed by #175
Closed

NullOrEmpty or NullOrWhiteSpace ignore the custom message when the input is null #174

Miljankg opened this issue Jan 6, 2022 · 0 comments · Fixed by #175

Comments

@Miljankg
Copy link
Contributor

Miljankg commented Jan 6, 2022

  • .NET SDK Version: 6.0.101

Description: When NullOrEmpty or NullOrWhiteSpace are used, a custom message can be set. However, if the input is null, the message contained within the exception thrown by the mentioned Guard clauses will be different than one set as the clause parameter.

Steps to Reproduce:

  1. Use Ardalis.GuardClauses 3.3.0 NuGet Package.
  2. Ensure that Guard.Against.NullOrEmpty is invoked with the input parameter being null, parameterName parameter being "parameterName" and custom message set (e.g. "Some Test Message").
  3. Examine the exception thrown by the Guard clause and check the Message property.
  4. The Message property will be "Value cannot be null. (Parameter 'parameterName')" instead of the message set previously.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant