Conversation

andyleejordan

So that events registered with the OnIdle engine event handler will always work.

Resolves PowerShell/vscode-powershell#4048

I added the following code to my profile:

Register-EngineEvent -SourceIdentifier PowerShell.OnIdle -MaxTriggerCount 10 -Action {
  Write-Host "OnIdle"
}

and was able to repro the linked issue before this change, and cannot repro it afterwards.

There may be other ramifications that we're not seeing though, and I'd be curious about a regression test for this.

@andyleejordanandyleejordan requested a review from a team September 13, 2022 01:05
@andyleejordanandyleejordan changed the title Created a nested PowerShell for the top-level root Created a nested PowerShell for the top-level loop Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice approach ❤️ my take was going to be a little bit more hacky since it would happen earlier in start up. This is better

@andyleejordan

The plus side of spending that feverish day looking at the Get-Variable code was that I got a better understanding of the runspace/nested/availability stuff. It's still pretty obtuse to me, but hey this works.

So that events registered with the `OnIdle` engine event handler will
always work.
Sign up for free to join this conversation on . Already have an account? Sign in to comment
Area-Startup Issue-BugA bug to squash.
No open projects
Status: Done

Successfully merging this pull request may close these issues.

Error on Integrated Console Start - PSInvalidOperationException Pipeline Issue