-
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
Fix Get-FormatData
attempting to incorrectly cast a type
#21157
base: master
Are you sure you want to change the base?
Conversation
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) |
Get-FormatData
attempting to incorrect cast a typeGet-FormatData
attempting to incorrectly cast a type
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.
looks good, I also appreciate the verbose statement.
Should there be any validation for this?
As noted in the PR description, wasn't able to find an easy test case so manually verified with |
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<data name="LineLessThanOne" xml:space="preserve"> |
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 string is newly added but doesn't seem to be used.
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.
Good catch, was a copy-paste error from another resx file
src/Microsoft.PowerShell.Commands.Utility/resources/GetFormatDataStrings.resx
Outdated
Show resolved
Hide resolved
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
PR Summary
Deep in the formatdata code, it assumes a member is of a type and can be cast to another type which throws. Not able to determine a simple case to add a test case, but validated manually with
posh
module the fix works. Also added a verbose message on which formatdata viewdefinition is being processed when it fails, but it doesn't end up being too useful, but perhaps still ok to keep since verbose isn't default (although not sure since it fails onFileSystemTypes
, but only ifposh
module is imported as it seems to be modifying that format data, but don't have the module information anymore).PR Context
Fix #21139
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).