Skip to content

PowerShell process occasionally terminates due to Win32 internal error at SetConsoleCursorPosition #15254

@masaru-iritani

Description

@masaru-iritani

I'm seeing an exception terminating PowerShell when I run a script calling devenv.com inside. Because that happens occasionally, I want to understand if there is a similar known issue or how I can collect actionable logs.

Steps to reproduce

Run a PowerShell script invoking DevEnv.com (v16.9.2) in Windows Terminal Preview 1.7.572.0. The script also calls Write-Progress as well as Write-Information before that.

Expected behavior

The script always completes without terminating PowerShell process.

Actual behavior

PowerShell process terminates. This happens once out of 10-20 times. An error message is output as follows. I must close the window and start a new PowerShell window.

Process terminated. The Win32 internal error "The parameter is incorrect." 0x57 occurred while trying to set the cursor position. Contact Microsoft Customer Support Services.
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32)
   at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])
System.Management.Automation.Host.HostException: The Win32 internal error "The parameter is incorrect." 0x57 occurred while trying to set the cursor position. Contact Microsoft Customer Support Services.
 ---> System.ComponentModel.Win32Exception (87): The parameter is incorrect.
   --- End of inner exception stack trace ---
   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.ConsoleHostUserInterface.ResetProgress()
   at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception& exceptionThrown, ExecutionOptions options)
   at Microsoft.PowerShell.Executor.ExecuteCommand(String command, Exception& exceptionThrown, ExecutionOptions options)
   at Microsoft.PowerShell.ConsoleHost.InputLoop.Run(Boolean inputLoopIsNested)
   at Microsoft.PowerShell.ConsoleHost.InputLoop.RunNewInputLoop(ConsoleHost parent, Boolean isNested)
   at Microsoft.PowerShell.ConsoleHost.EnterNestedPrompt()
   at Microsoft.PowerShell.ConsoleHost.DoRunspaceLoop(String initialCommand, Boolean skipProfiles, Collection`1 initialCommandArgs, Boolean staMode, String configurationName)
   at Microsoft.PowerShell.ConsoleHost.Run(CommandLineParameterParser cpp, Boolean isPrestartWarned)
   at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText)
   at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
[process exited with code 2148734499]

The exception is thrown on executing the following line.

& DevEnv.com $sln /$Target "$Configuration|$Platform" /Project $Project | Tee-Object -Variable 'output'

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.0-preview.4
PSEdition                      Core
GitCommitId                    7.2.0-preview.4
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

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productWG-Interactive-Consolethe console experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions