public async Task <List <BreakpointDetails> > SetLineBreakpoints( PowerShellContext powerShellContext, string scriptPath, BreakpointDetails[] breakpoints) { List <BreakpointDetails> resultBreakpointDetails = new List <BreakpointDetails>(); // We always get the latest array of breakpoint line numbers // so store that for future use if (breakpoints.Length > 0) { // Set the breakpoints for this scriptPath this.breakpointsPerFile[scriptPath] = breakpoints.Select(b => b.LineNumber).ToArray(); } else { // No more breakpoints for this scriptPath, remove it this.breakpointsPerFile.Remove(scriptPath); } string hashtableString = string.Join( ", ", this.breakpointsPerFile .Select(file => $"@{{Path=\"{file.Key}\";Line=@({string.Join(",", file.Value)})}}")); // Run Enable-DscDebug as a script because running it as a PSCommand // causes an error which states that the Breakpoint parameter has not // been passed. await powerShellContext.ExecuteScriptString( hashtableString.Length > 0 ?$"Enable-DscDebug -Breakpoint {hashtableString}" : "Disable-DscDebug", false, false); // Verify all the breakpoints and return them foreach (var breakpoint in breakpoints) { breakpoint.Verified = true; } return(breakpoints.ToList()); }