- Notifications
You must be signed in to change notification settings - Fork7.7k
Explicitly specify ErrorRecord to use in DetailedView error format script#25627
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
@iSazonov Afaict, this PR has been approved and ready to merge, is there anything I need to do on my end to get it merged? |
@MatejKafka Could you please add new simple test? |
d249716
tof9ad262
Compare@iSazonov Added a test and cleaned up the test file a bit. |
@MatejKafka Please remove all unrelated changes - it saves reviewer's time. |
f9ad262
to566089a
Compare@iSazonov Moved to a separate PR. |
@@ -211,5 +211,14 @@ Describe 'Tests for $ErrorView' -Tag CI { | |||
$e | Should -BeExactly (Get-Error | Out-String).Trim([Environment]::NewLine.ToCharArray()) | |||
} | |||
It 'Renders the passed error instead of the last one' { | |||
# PR #25627 |
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.
# PR #25627 |
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.
Why remove the comment? It is useful to get more context as to why such a weird behavior is even tested.
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.
We never add such comments.
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for7 days. |
PR Summary
Previously, formatting for
DetailedView
of error records inOut-Default
calledGet-Error
without parameters, which picked up the last thrown error instead of the actually passedErrorRecord
. This PR explicitly passes the formattedErrorRecord
toGet-Error
.PR Context
Currently, if you try to override
Out-Default
and then use.GetSteppablePipeline()
to call the originalOut-Default
, errors are not printed at all when inDetailedView
. Not entirely sure why, but this change fixes it, and the current code is pretty obviously incorrect.PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright header