-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add ArgumentNullException.ThrowIfNull #55594
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
src/libraries/System.Private.CoreLib/src/System/ArgumentNullException.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System/ArgumentNullExceptionTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/ArgumentNullException.cs
Outdated
Show resolved
Hide resolved
@stephentoub Sorry if I'm missing some context. I'm confused by "We will wait to roll this out broadly across dotnet/runtime until the !! feature from C# is available. C# may be able to target this method now or in the future now that it exists [...]". The notes I had from email thread were:
So the compiler will not be targeting this method. |
@jcouv, sorry for the confusion. What I meant was, I'm not going to first replace all of the thousands of throw sites with a manual call to |
Fixes #48573
We will wait to roll this out broadly across dotnet/runtime until the !! feature from C# is available. C# may be able to target this method now or in the future now that it exists, and we'll use it explicitly in places where we can't rely on the C# feature, e.g. where we need to do the checks in a different order from what the compiler would emit (but the 90% case should end up using the C# feature).
In this PR I've only replaced call sites that had their own ThrowIfNull/NotNull already being used.
cc: @jcouv, @bartonjs