-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Throw ArgumentNullException with nameof(param), not "param" #15604
Throw ArgumentNullException with nameof(param), not "param" #15604
Conversation
} | ||
|
||
if (parent == null) | ||
{ | ||
throw new ArgumentNullException("element"); | ||
throw new ArgumentNullException(nameof(parent)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this was a copy-paste mistake.
@gukoff Thanks for your contribution! Code under Microsoft.Management.UI.Internal is frozen and shouldn't be changed. The same for remoting code (WinRM). |
See also stale PR: #13875 |
8ca1bdd
to
484508a
Compare
Removed
If It looks like the overlap with #13875 is minimal - only in To me, it makes sense to merge this one and then return to #13875 where a lot of similar work has been done. |
CodeFactor "Complex Method" new issues are false positives. |
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs
Show resolved
Hide resolved
@@ -711,7 +711,7 @@ public override bool CanConvertFrom(object sourceValue, Type destinationType) | |||
{ | |||
if (destinationType == null) | |||
{ | |||
throw new ArgumentNullException("destinationType"); | |||
throw new ArgumentNullException(nameof(destinationType)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Microsoft.PowerShell.ScheduledJob is not compiled in the repo and we can not accept the changes.
src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProviderTraceListener.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
It's not clear why the error view tests would fail. Re-run the corresponding jobs to see if it's intermittent. |
ConciseView test fails. |
ab3435b
to
7e7ef2b
Compare
7e7ef2b
to
a2a4f5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine keeping the change as is. The fact that a few ConciseView tests failed after changing to use new ArgumentNullException()
in properties indicates that change could be breaking (though it shouldn't ...).
@xtqqczze If you are interested, please go ahead making that change for the properties, and see if ConciseView
has an unexpected dependency somehow.
LGTM |
As a side note - don't you want add a PR check that there's no diff in |
🎉 Handy links: |
PR Summary
Refactoring of ArgumentNullException-s.
It covers a few files but not the whole solution.
Similar effort in the past: #13875
PR Context
Follow the best practice of throwing argument exceptions: https://www.jetbrains.com/help/resharper/UseNameofExpression.html
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).