From abefb1b5d5f9ae2e0baedcc96e8b69c3e73c0676 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Sun, 3 Dec 2017 13:34:44 -0700 Subject: [PATCH 1/3] Fix bkpt set issue with network location going away --- .../Server/DebugAdapter.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs b/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs index 0b50dca3b..f595b25b7 100644 --- a/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs +++ b/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs @@ -15,6 +15,7 @@ using System.IO; using System.Linq; using System.Management.Automation; +using System.Security; using System.Text; using System.Threading.Tasks; @@ -497,13 +498,19 @@ protected async Task HandleSetBreakpointsRequest( scriptFile = editorSession.Workspace.GetFile(setBreakpointsParams.Source.Path); } } - catch (Exception e) when (e is FileNotFoundException || e is DirectoryNotFoundException) + catch (Exception e) when ( + e is FileNotFoundException || + e is DirectoryNotFoundException || + e is IOException || + e is NotSupportedException || + e is PathTooLongException || + e is SecurityException) { - Logger.Write( - LogLevel.Warning, - $"Attempted to set breakpoints on a non-existing file: {setBreakpointsParams.Source.Path}"); + Logger.WriteException( + $"Failed to set breakpoint on file: {setBreakpointsParams.Source.Path}", + e); - string message = this.noDebug ? string.Empty : "Source does not exist, breakpoint not set."; + string message = this.noDebug ? string.Empty : "Source file could not be accessed, breakpoint not set - " + e.Message; var srcBreakpoints = setBreakpointsParams.Breakpoints .Select(srcBkpt => Protocol.DebugAdapter.Breakpoint.Create( From d023a708ff82a72b1cef20fe26cfeaee99307a99 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Sun, 3 Dec 2017 13:38:40 -0700 Subject: [PATCH 2/3] Missed UnauthorizedAccessException --- src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs b/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs index f595b25b7..d656aa6c5 100644 --- a/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs +++ b/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs @@ -504,7 +504,8 @@ e is DirectoryNotFoundException || e is IOException || e is NotSupportedException || e is PathTooLongException || - e is SecurityException) + e is SecurityException || + e is UnauthorizedAccessException) { Logger.WriteException( $"Failed to set breakpoint on file: {setBreakpointsParams.Source.Path}", From 5f3fffa71d98b084dfb2df5fd0b8dc8022563947 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Mon, 4 Dec 2017 20:10:55 -0700 Subject: [PATCH 3/3] Kick another build --- src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs b/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs index d656aa6c5..333d693f2 100644 --- a/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs +++ b/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs @@ -512,7 +512,6 @@ e is SecurityException || e); string message = this.noDebug ? string.Empty : "Source file could not be accessed, breakpoint not set - " + e.Message; - var srcBreakpoints = setBreakpointsParams.Breakpoints .Select(srcBkpt => Protocol.DebugAdapter.Breakpoint.Create( srcBkpt, setBreakpointsParams.Source.Path, message, verified: this.noDebug));