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-Error serialization of array values #21085
Conversation
Ensure Get-Error does not hang when attempting to serialize an exception that contains a property whose type is an array of System.Type instances. Also ensures that primitive types like System.Int32, System.Boolean as well as System.String is formatted as a string rather than an object with properties.
17cd2c0
to
515a09e
Compare
@jborean93 I created a PR to your branch with some suggested changes jborean93#1. Note that I didn't update your tests |
test/powershell/Modules/Microsoft.PowerShell.Core/Get-Error.Tests.ps1
Outdated
Show resolved
Hide resolved
I really don't care as long as the changes you want still work or this is fixed in any other way. Feel free to push your commits onto mine without going through a PR (as long as you also fix the tests). |
I forgot to mention I didn’t use |
@jborean93 I didn't want to just push commits since it's your PR. I've updated my PR to your branch to have consistency with non-array types to be in square brackets and added that to the test. |
fix indentation and render types with square brackets
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) |
Any chance for a backport to 7.4? |
Ensure Get-Error does not hang when attempting to serialize an exception that contains a property whose type is an array of System.Type instances. Also ensures that primitive types like System.Int32, System.Boolean as well as System.String is formatted as a string rather than an object with properties.
Ensure Get-Error does not hang when attempting to serialize an exception that contains a property whose type is an array of System.Type instances. Also ensures that primitive types like System.Int32, System.Boolean as well as System.String is formatted as a string rather than an object with properties.
Ensure Get-Error does not hang when attempting to serialize an exception that contains a property whose type is an array of System.Type instances. Also ensures that primitive types like System.Int32, System.Boolean as well as System.String is formatted as a string rather than an object with properties.
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.
Thanks for your efforts..
PR Summary
Ensure Get-Error does not hang when attempting to serialize an exception that contains a property whose type is an array of System.Type instances. Also ensures that primitive types like System.Int32, System.Boolean as well as System.String is formatted as a string rather than an object with properties.
This will no longer hang
It also ensures that exception with a property containing an array of primitive types (+
[string]
) is formatted as that primitive type. For example this exceptionCurrently this looks like
With these changes it now looks like (note
Values :
in theException
).PR Context
Fixes: #21083
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).