-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Fix Get-ItemProperty
to report non-terminating error for cast exception
#21115
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
Fix Get-ItemProperty
to report non-terminating error for cast exception
#21115
Conversation
test/powershell/Modules/Microsoft.PowerShell.Management/Registry.Tests.ps1
Outdated
Show resolved
Hide resolved
@ArmaanMcleod We need to skip new test code on Windows. |
@iSazonov Do you mean we should skip if not windows and powershell core? Makes sense if this is for new test it should only work for powershell core on windows. I've added conditions to lock tests to windows only. |
test/powershell/Modules/Microsoft.PowerShell.Management/Registry.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Management/Registry.Tests.ps1
Outdated
Show resolved
Hide resolved
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
src/System.Management.Automation/namespaces/RegistryProvider.cs
Outdated
Show resolved
Hide resolved
📣 Hey @ArmaanMcleod, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback |
PR Summary
Fixes #9552
Adds catch for
InvalidCastException
so non-terminating error gets reported instead of terminating error when listing subkeys with 64 bit integer in 32 bit DWORD.PR Context
Currently if you do this you get a terminating error for the cast and command is halted. With this exception handling we can now get non-terminating error and also suppress error with
-ErrorAction SilentlyContinue
.Get-ItemProperty
will continue to enumerate subkeys even if an invalid one is found.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).