System Details
### VSCode version: 1.56.2 054a9295330880ed74ceaedda236253b4f39a335 x64
### VSCode extensions:
ms-python.python@2021.5.842923320
ms-toolsai.jupyter@2021.6.832593372
ms-vscode.powershell@2021.2.2
### PSES version: 2.3.0.0
### PowerShell version:
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Description
Cmdlet.WriteProgress() fails infrequently during long running cmdlets, potentially resulting in hours of lost CPU time due to unexpected script failure. This appears to be some type of VS Code-PowerShell 7 integration issue that's new since January but so far I've been unable to identify a reliable repro. The call to WriteProgress() itself has been stable in our cmdlet code for about a year, though the data given to it does change from run to run.
Expected Behaviour
Cmdlet.WriteProgress() succeeds.
Actual Behaviour
> $Error[0].Exception
ErrorRecord : The Win32 internal error "The parameter is incorrect." 0x57 occurred while trying to set the cursor
position. Contact Microsoft Customer Support Services.
WasThrownFromThrowStatement : False
TargetSite : Void SetConsoleCursorPosition(Microsoft.Win32.SafeHandles.SafeFileHandle,
System.Management.Automation.Host.Coordinates)
StackTrace : at Microsoft.PowerShell.ConsoleControl.SetConsoleCursorPosition(SafeFileHandle consoleHandle,
Coordinates cursorPosition)
at Microsoft.PowerShell.ConsoleHostRawUserInterface.set_CursorPosition(Coordinates value)
at Microsoft.PowerShell.ProgressPane.Hide()
at Microsoft.PowerShell.ProgressPane.Show(PendingProgress pendingProgress)
at Microsoft.PowerShell.ConsoleHostUserInterface.WriteProgress(Int64 sourceId, ProgressRecord record)
at System.Management.Automation.Internal.Host.InternalHostUserInterface.WriteProgress(Int64 sourceId,
ProgressRecord record)
at Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorServicesPSHostUserInterface.Write
Progress(Int64 sourceId, ProgressRecord record) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShell
Context\Session\Host\EditorServicesPSHostUserInterface.cs:line 625
at System.Management.Automation.Internal.Host.InternalHostUserInterface.WriteProgress(Int64 sourceId,
ProgressRecord record)
at System.Management.Automation.MshCommandRuntime.WriteProgress(Int64 sourceId, ProgressRecord
progressRecord, Boolean overrideInquire)
at System.Management.Automation.Cmdlet.WriteProgress(ProgressRecord progressRecord)
at Cmdlet`1.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
Message : The Win32 internal error "The parameter is incorrect." 0x57 occurred while trying to set the cursor
position. Contact Microsoft Customer Support Services.
Data : {}
InnerException : System.ComponentModel.Win32Exception (87): The parameter is incorrect.
HelpLink :
Source : Microsoft.PowerShell.ConsoleHost
HResult : -2146233087
Attached Logs
vscode-powershell.zip
System Details
Issue Description
Cmdlet.WriteProgress() fails infrequently during long running cmdlets, potentially resulting in hours of lost CPU time due to unexpected script failure. This appears to be some type of VS Code-PowerShell 7 integration issue that's new since January but so far I've been unable to identify a reliable repro. The call to WriteProgress() itself has been stable in our cmdlet code for about a year, though the data given to it does change from run to run.
Expected Behaviour
Cmdlet.WriteProgress() succeeds.
Actual Behaviour
Attached Logs
vscode-powershell.zip