From cd98db9b84d96ffb922f7894ac1d5ecf66f954fd Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Wed, 9 Oct 2019 11:26:16 -0700 Subject: [PATCH] show line context information if multiple lines but no scriptname --- .../DefaultFormatters/PowerShellCore_format_ps1xml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs index 50b68355373..6771c91c22f 100644 --- a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs +++ b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs @@ -879,7 +879,7 @@ function Get-ConciseViewPositionMessage { $prefix = '' $newline = [Environment]::Newline - if ($myinv -and $myinv.ScriptName -or $_.CategoryInfo.Category -eq 'ParserError') { + if ($myinv -and $myinv.ScriptName -or $myinv.ScriptLineNumber -gt 1 -or $_.CategoryInfo.Category -eq 'ParserError') { if ($myinv.ScriptName) { $posmsg = ""${resetcolor}$($myinv.ScriptName)${newline}"" }