GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||
GeezerVison is showing github.com — Fix xml nesting bug in CustomSerializer.WriteMemberInfoCollection() by IISResetMe · Pull Request #8476 · PowerShell/PowerShell Conversation
Collaborator
PR SummaryFix #8308
This PR moves the PR Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Decrementing `depth` makes no sense here and causes nested PSObject instances with more than one property to generate invalid xml This reverts commit 56e07a0. WriteMemberInfoCollection() incorrectly nests sibling elements at depth==0 The reason seems to be that WriteMemberInfoCollection() calls WriteEndElement() at most once, even if `WriteStartElement()` has been called more than once
Mathias R. Jessen (IISResetMe)
requested review from
James Truher (JamesWTruher) and
Paul Higinbotham (PaulHigin)
as code owners
Uh oh!
There was an error while loading. Please reload this page. …-Xml.Tests.ps1 Co-Authored-By: IISResetMe <[email protected]>
Paul Higinbotham (PaulHigin)
suggested changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes look right to me ... not sure what was originally intended. But can you also remove the
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, I renamed the first parameter to
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsRemoved unused parameters `depth` and `writeEnclosingMemberSetElementTag`, renamed `me` to `members` …b.com/IISResetMe/PowerShell into patch/invalid-xml-CustomSerialization
Paul Higinbotham (PaulHigin)
approved these changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Collaborator
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Collaborator
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Collaborator
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Ilya (iSazonov)
approved these changes
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
| |||||||||||||||||||||||||
There was an error while loading. Please reload this page.
|
Please be aware that this issue shouldn't only concern the technical fix of #7290 but also the presumed compatibility with prior versions. Meaning: a lot of scripts in the field might break due to this change! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
iRon7 In the PR we fix a bug in ConvertTo-Xml cmdlet but you reference a ConvertTo-Json - could you clarify that you mean? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I am sorry, I guess my comment wasn't that clear. What I mean is, that appearently every user of the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
iRon7 one approach could be:
Doesnt have to be 2 just because that's the case for the json cmdlet |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Mathias R. Jessen (@IISResetMe). Yes, changing the default depth might work but could cause a performance impact for existing scripts were the default depth (of 2) did work. Get-Service | ConvertTo-Xml takes ~700ms, where: Get-Service | ConvertTo-Xml -Depth 5 takes 6.5 minutes... |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Mathias R. Jessen (@IISResetMe) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Paul Higinbotham (@PaulHigin) A code you reference is not new code so the change is not related the PR. I believe we get better code with fixing #7290. Mathias R. Jessen (@IISResetMe) Are ready to fix #7290?
iRon7 Please open new performance issue so we can investigate this problem. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ilya (@iSazonov), I do not have a performance issue (...yet). Just some concerns that the fix (even it is technically correct) might break a few scripts in the field and if you try to prevent that with a higher default |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Steve Lee (@SteveL-MSFT) We need an additional review from MSFT experts and get a conclusion about iRon7's concerns - can we merge before PowerShell Committee review #7290? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think the scope of these changes is ok to accept without waiting on conclusion of #7290 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I just found a similar issue with a $Parent = [PSCustomObject]@{ Name = "Parent" } $Child = [PSCustomObject]@{ Name = "Child" } $Parent | Add-Member Child $Child $Child | Add-Member Parent $Parent But the error message is completely different from #7290 PS C:\> $Parent | ConvertTo-Xml
I am not sure whether this is covered in the upcoming fix and tests |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
iRon7 You can download a latest night build from main page of the repo and test. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…owerShell#8476) WriteMemberInfoCollection() calls WriteEndElement() at most once, even if WriteStartElement() has been called more than once. This commit moves the WriteEndElement() call up immediately after the elements text value has been written.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
ConvertTo-Xml fails with nested custom objects: omits closing </Objects> tag
There was an error while loading. Please reload this page.