Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upFix PSVersion check in `Get-FormatData` to return format data #8063
Conversation
SteveL-MSFT
assigned
adityapatwardhan
Oct 18, 2018
SteveL-MSFT
requested review from
anmenaga and
PaulHigin
Oct 18, 2018
SteveL-MSFT
requested a review
from
JamesWTruher
as a
code owner
Oct 18, 2018
SteveL-MSFT
referenced this pull request
Oct 18, 2018
Open
Changes to FileSystem.Format.ps1xml #8060
adityapatwardhan
approved these changes
Oct 18, 2018
adityapatwardhan
merged commit 3ceb1c1
into
PowerShell:master
Oct 19, 2018
8 checks passed
SteveL-MSFT
deleted the
SteveL-MSFT:get-formatdata
branch
Oct 20, 2018
This comment has been minimized.
This comment has been minimized.
JoeSalmeri
commented
Apr 5, 2019
|
Hi Steve, I have been anxiously awaiting this fix to test out the issues we discussed last year. Unfortunately the problems do not appear to be fixed and things appear to be seriously broken still to the point that the results are unusable. Run these commands
If you compare DirectoryInfo.ps1xml and FileInfo.ps1xml you will find the are exactly the same, however, the output for a directory item versus a file item should not be the same as a directory does not contain a length. Ignoring that issue, the results returned are missing lots of XML code that was previously in FileSystem.format.ps1xml. I won't detail them all here as you can compare the results produced of Get-FormatData with the old FileSystem.format.ps1xml file to see them all, however, I will point out a few. FileSystem.format.ps1xml created a SelectionSet named FileSystemTypes and then used that and a CustomControlName FileSystemTypes-GroupingFormat for the view definitions. Those are all missing from the "Get-FormatData" results for System.IO.DirectoryInfo / System.IO.FileInfo. Ignore those issues, I attempted to merge my changes into the results returned from Get-FormatData and I found that my changes were not displaying so I did this simple test.
I believe all of these issues are because Get-FormatData is not returning the full and correct format data for these types. If I run "Update-FormatData -Prepend My,FileSystem.format.ps1" which uses the modified version of the old FileSystem.format.ps1xml file that used to be included in PowerShell, then everything works correctly and it has my changes. So we are back to the original problem. There needs to be a way for me to obtain the format data being used (either via a file like it previously did or with Get-FormatData returning the correct formatting that is really being used). Since PowerShell is no longer including the *.format.ps1xml files and Get-FormatData is broken and does not return the correct format data I have no way to determine what changes were made in new versions of PowerShell so that I can integrate them into my modified version. I hope that this can be made a priority and get fixed soon. Holler if you want any more details. Thanks! Joe |
SteveL-MSFT commentedOct 18, 2018
•
edited
PR Summary
The FormatData format changed in version 5.1 so during remoting a client specifies the version of PowerShell FormatData it can understand.
In the case of FileInfo (and DirectoryInfo), the format requires 5.1 so remoting must pass the
-PowerShellVersion 5.1parameter to successfully get format data. There is a bug in the logic to validate the version and it was validating the build number. So the version string5.1fails this check because it does not include a version number (which defaults to -1). The fix is to remove the check on the build number and simply rely on major version and minor version.Fix #4237
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests