From 1c61db4e9268b4b4b4b32f84c5f20043e1765be3 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Wed, 22 Apr 2020 13:03:41 -0600 Subject: [PATCH 1/2] Fix interpolation in Log points, switch to double quotes Fix #2654 --- .../Services/DebugAdapter/Debugging/BreakpointApiUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/BreakpointApiUtils.cs b/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/BreakpointApiUtils.cs index 353ebf561..b5346a87a 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/BreakpointApiUtils.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/BreakpointApiUtils.cs @@ -177,7 +177,7 @@ public static ScriptBlock GetBreakpointActionScriptBlock(string condition, strin StringBuilder builder = new StringBuilder( string.IsNullOrEmpty(logMessage) ? "break" - : $"Microsoft.PowerShell.Utility\\Write-Host '{logMessage}'"); + : $"Microsoft.PowerShell.Utility\\Write-Host \"{logMessage}\""); // If HitCondition specified, parse and verify it. if (!(string.IsNullOrWhiteSpace(hitCondition))) From 015d33d308784bbe5fe49146b00bd7e6ba092ea6 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Wed, 22 Apr 2020 18:21:45 -0600 Subject: [PATCH 2/2] Escape double quotes for log point msgs to make using them easier --- .../Services/DebugAdapter/Debugging/BreakpointApiUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/BreakpointApiUtils.cs b/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/BreakpointApiUtils.cs index b5346a87a..4e8816cfd 100644 --- a/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/BreakpointApiUtils.cs +++ b/src/PowerShellEditorServices/Services/DebugAdapter/Debugging/BreakpointApiUtils.cs @@ -177,7 +177,7 @@ public static ScriptBlock GetBreakpointActionScriptBlock(string condition, strin StringBuilder builder = new StringBuilder( string.IsNullOrEmpty(logMessage) ? "break" - : $"Microsoft.PowerShell.Utility\\Write-Host \"{logMessage}\""); + : $"Microsoft.PowerShell.Utility\\Write-Host \"{logMessage.Replace("\"","`\"")}\""); // If HitCondition specified, parse and verify it. if (!(string.IsNullOrWhiteSpace(hitCondition)))