From 348ca859475eb0094f97791d0f6c8717577d2935 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Wed, 4 Mar 2020 13:03:08 -0800 Subject: [PATCH] Fix `ConciseView` to split `PositionMessage` using `[Environment]::NewLine` (#12010) --- .../DefaultFormatters/PowerShellCore_format_ps1xml.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 e7003f47585a..09cc323b9365 100644 --- a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs +++ b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs @@ -1100,8 +1100,7 @@ private static IEnumerable ViewsOf_System_Management_Autom $offsetInLine = 0 } else { - # use newline char instead of $newline because that is what is in the message - $positionMessage = $myinv.PositionMessage.Split(""`n"") + $positionMessage = $myinv.PositionMessage.Split($newline) $line = $positionMessage[1].Substring(1) # skip the '+' at the start $highlightLine = $positionMessage[$positionMessage.Count - 1].Substring(1) $offsetLength = $highlightLine.Trim().Length