Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created a nested PowerShell for the top-level loop #1918

Merged
merged 1 commit into from
Sep 13, 2022

Conversation

andyleejordan
Copy link
Member

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.

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

@SeeminglyScience SeeminglyScience left a comment

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
Copy link
Member Author

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 GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Error on Integrated Console Start - PSInvalidOperationException Pipeline Issue
2 participants