Skip to content

Use ArgumentOutOfRangeException.Throw helpers in more places#79460

Merged
stephentoub merged 4 commits into
dotnet:mainfrom
stephentoub:moreaoorethrow
Dec 11, 2022
Merged

Use ArgumentOutOfRangeException.Throw helpers in more places#79460
stephentoub merged 4 commits into
dotnet:mainfrom
stephentoub:moreaoorethrow

Conversation

@stephentoub

Copy link
Copy Markdown
Member

I ran the new analyzer and auto-fixed all the occurrences.

However, the analyzer is also conservative and won't flag throws that are using a customized message, so I also searched for some messages known to not provide any additional useful information and replaced those call sites.

There are still more cases that can be evaluated subsequently.

@ghost

ghost commented Dec 9, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-meta
See info in area-owners.md if you want to be subscribed.

Issue Details

I ran the new analyzer and auto-fixed all the occurrences.

However, the analyzer is also conservative and won't flag throws that are using a customized message, so I also searched for some messages known to not provide any additional useful information and replaced those call sites.

There are still more cases that can be evaluated subsequently.

Author: stephentoub
Assignees: -
Labels:

area-Meta

Milestone: 8.0.0

@MihaZupan MihaZupan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful diff

Comment thread src/libraries/System.Private.CoreLib/src/System/Collections/Generic/HashSet.cs Outdated
Comment thread src/libraries/System.Private.CoreLib/src/System/IO/UnmanagedMemoryAccessor.cs Outdated
Comment thread src/libraries/System.Private.CoreLib/src/System/Globalization/JulianCalendar.cs Outdated
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
@stephentoub

Copy link
Copy Markdown
Member Author

/azp list

@azure-pipelines

Copy link
Copy Markdown
CI/CD Pipelines for this repository:

@stephentoub

Copy link
Copy Markdown
Member Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants