question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using PowerShell Preview v2021.11.1, PSReadLine throws an error every so often

See original GitHub issue

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!

### Environment
PSReadLine: 2.2.0-beta4
PowerShell: 2021.11.1
OS: Microsoft Windows 10.0.22000
BufferWidth: 230
BufferHeight: 26

Last 63 Keys:

 g e t - m o d u l e Enter
 g e t Backspace Backspace Backspace Backspace Backspace $ p s v e r s i o Tab Enter
 UpArrow . p s Tab Enter
 UpArrow Spacebar | g m Enter
 UpArrow Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace g i t q Backspace Tab Enter


### Exception

System.Management.Automation.PSInvalidOperationException: The pipeline was not run because a pipeline is already running. Pipelines cannot be run concurrently.
   at System.Management.Automation.Runspaces.PipelineBase.DoConcurrentCheck(Boolean syncCall, Object syncObject, Boolean isInLock)
   at System.Management.Automation.Runspaces.RunspaceBase.DoConcurrentCheckAndAddToRunningPipelines(PipelineBase pipeline, Boolean syncCall)
   at System.Management.Automation.Runspaces.PipelineBase.CoreInvoke(IEnumerable input, Boolean syncCall)
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke[T](IEnumerable input, PSInvocationSettings settings)
   at Microsoft.PowerShell.EditorServices.Services.PowerShell.Utility.PowerShellExtensions.InvokeAndClear[TResult](PowerShell pwsh, PSInvocationSettings invocationSettings) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShell\Utility\PowerShellExtensions.cs:line 50
   at Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution.SynchronousPowerShellTask`1.ExecuteNormally(CancellationToken cancellationToken) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShell\Execution\SynchronousPowerShellTask.cs:line 120
   at Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution.SynchronousPowerShellTask`1.Run(CancellationToken cancellationToken) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShell\Execution\SynchronousPowerShellTask.cs:line 55
   at Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution.SynchronousTask`1.ExecuteSynchronously(CancellationToken executorCancellationToken) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShell\Execution\SynchronousTask.cs:line 104
--- End of stack trace from previous location ---
   at Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution.SynchronousTask`1.get_Result() in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShell\Execution\SynchronousTask.cs:line 60
   at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.OnPowerShellIdle(CancellationToken idleCancellationToken) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 832
   at Microsoft.PowerShell.PSConsoleReadLine.ReadKey()
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

Screenshot

image

Environment data

PS Version: 7.2.0
PS HostName: Visual Studio Code Host
PSReadLine Version: 2.2.0-beta4
PSReadLine EditMode: Windows
OS: 10.0.22000.1 (WinBuild.160101.0800)
BufferWidth: 230
BufferHeight: 26PowerShell Preview
v2021.11.1

Steps to reproduce

On my system.

Starting VSCode, using the Windows Store Powershell or Powershell preview installation. Using the PowerShell Preview v2021.11.1 extension.

Without doing anything the error provided will pop up every now and then. (writing this generated 5 errors already) Just having the It breaks any running scripts I have going.

Using the normal PowerShell extension everything works fine.

Expected behavior

No PSreadline errors while using the PowerShell Preview v2021.11.1 extension.

Actual behavior

I’m unable to use the PowerShell Preview v2021.11.1 extension because of this PSReadline error happening a couple of time every few minute.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:21 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
StevenBucher98commented, Apr 19, 2022

Az.Tools.Predictor 1.0 GA’d and should no longer be one of the causes of this issue. Probably other cases that might trigger this so not entirely fixed. There is work arounds linked above

2reactions
daxian-dbwcommented, Jan 11, 2022

@andschwa The fix will be tricky. Please take a look at my comment about the problem: https://github.com/PowerShell/PSReadLine/pull/1679#issuecomment-947940473

We have https://github.com/PowerShell/PowerShellEditorServices/issues/1591 tracking the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

about PSReadLine - PowerShell | Microsoft Learn
PSReadLine provides an improved command-line editing experience in the PowerShell console.
Read more >
The specified module 'Module Name' was not loaded because ...
Fix “Import-Module: The specified module 'Module Name' was not loaded because no valid module file was found in any module directory” Error.
Read more >
Re enable Import Module Psreadline warning - Stack Overflow
Import-Module PSReadLine to your $PROFILE file and doing so will re-enable PSReadLine for a rich command-line editing experience, ...
Read more >
Windows 11 Powershell install Git solution | by Bill CX - Medium
If you like me trying to use windows 11 to do some real programming job, you could very easily encounter some weird issue...
Read more >
PowerShell 7.2.0 - Could not load type System.Management ...
However, my fancy prompt use PSReadLine with Predictive Autocomplete stopped working suddenly. However, suddenly I started getting this error on ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found