From 36bc894d9be1f9a8274392375bd1079cfbb2f77b Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Thu, 10 Oct 2019 04:06:43 -0700 Subject: [PATCH] For `ConciseView`, show line context information if multiple lines but no scriptname (#10746) --- .../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 50b683553..6771c91c2 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 @@ namespace System.Management.Automation.Runspaces $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}"" }