-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Fix NRE in ActionPreference parameters #11779
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
Conversation
PaulHigin
left a comment
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.
This looks right to me. I can't think of any negative consequences in making this change, since it currently throws NRE.
edf1f50 to
6abd5c4
Compare
|
I think the right fix should be in the parameter binding code, where the |
|
@daxian-dbw My initial thoughts was the same. But after I look the binding code I think the code is too sensitive (we can break something) and the simple fix is more reliable. The code is in ReflectionParameterBinder()
Can we safely replace |
|
The fix should be doing the same as in here: PowerShell/src/System.Management.Automation/engine/ReflectionParameterBinder.cs Lines 233 to 249 in e9152a5
|
|
@daxian-dbw #12124 returns better error message so I close current PR. |
PR Summary
Fix #11692
Add ValidateNotNull attribute to ErrorAction, WarningAction and InformationAction common parameters.
PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.