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