Skip to content

Fix inconsistent newline stripping in ConciseView (#24108)#27160

Open
reabr wants to merge 2 commits intoPowerShell:masterfrom
reabr:fix/issue-24108-conciseview-newlines
Open

Fix inconsistent newline stripping in ConciseView (#24108)#27160
reabr wants to merge 2 commits intoPowerShell:masterfrom
reabr:fix/issue-24108-conciseview-newlines

Conversation

@reabr
Copy link
Copy Markdown
Contributor

@reabr reabr commented Apr 2, 2026

Summary

Fixes inconsistent newline handling in $ErrorView = 'ConciseView' where multi-line error messages were sometimes collapsed to a single line and sometimes preserved, depending on whether the error originated from a direct function call or a wrapper/module call.

Problem

In ConciseView, the code that strips \r\n and \n from error messages was wrapped inside a conditional block:

if ($myinv -and $myinv.ScriptName -or $err.CategoryInfo.Category -eq 'ParserError') {
    $message = $message.Replace($newline, ' ').Replace("`n", ' ').Replace("`t", ' ')
}

@reabr reabr requested a review from a team as a code owner April 2, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant