-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use ArgumentOutOfRangeException.ThrowIf* to replace custom error messages #8408
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d2a8181 to
c557917
Compare
c557917 to
ebd615d
Compare
Contributor
|
Hey @halgab , I think we also need to update these changes to the files below: |
Contributor
Author
|
I kept those because of the asserts. But I'd be happy to make the change! |
Contributor
Author
Actually that's not true. Those fell off my radar because they're not part of the solution. I'll make the change. |
ebd615d to
fdae6c3
Compare
rchauhan18
approved these changes
Nov 27, 2023
Contributor
|
Thanks @halgab for contributing! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Community Contribution
A label for all community Contributions
PR
metadata: Label to tag PRs, to facilitate with triage
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a followup to #8403.
Description
Many error messages can be replaced with messages from the BCL using the new
ArgumentOutOfRangeExceptionthrow helpers.Here are the messages I removed, each in its own commit:
ParameterMustBeBetween would be a good candidate, but this would slightly change the information conveyed by the error message. I still think it's worth it though.
ParameterValueCannotBeInfinity and ParameterValueCannotBeNaN also come to mind.
Customer Impact
Slight performance improvement, and a bit fewer resources.
Regression
No
Testing
CI
Risk
Low. I manually searched and removed the error messages, and let CA1512 finish the work
Microsoft Reviewers: Open in CodeFlow