Vscode-powershell: Windows spawned from integrated console are hidden behind VS Code window

Created on 24 Mar 2017  路  15Comments  路  Source: PowerShell/vscode-powershell

Update

This is an issue in VSCode that the PowerShell extension has no control over. In fact it's an issue in electron that has yet to be fixed.

To resolve this issue, we are waiting on a solution from VSCode.

Original Issue

There's a general problem where windows spawned from within the PowerShell process are being shown below the VS Code window, more than likely because their window parent is a non-visible powershell.exe process. I need to check if there's a way to set powershell.exe's window parent to VS Code so that windows spawned from within are ultimately parented to VS Code's window instead.

Issue-Bug vscode-bug

Most helpful comment

@corbob - looks like electron also passed on owning this issue - they refer to using forcefocus as a workaround.

It does seem to be a hard problem, but from a user experience perspective we could do better - maybe we can consider using forcefocus in vscode for this use case. If this is your first user experience with vscode like @cbailiss - you are less likely to continue using the editor and shell as it doesn't work.

Visual Studio doesn't have any of these windowing issues, but it's also not electron-based.

All 15 comments

easy to test with:
Invoke-Item .
or
Login-AzureRmAccount

Thanks Matt!

Is it possible to get this added to milestone 44 or 45
https://github.com/PowerShell/vscode-powershell/milestone/44
https://github.com/PowerShell/vscode-powershell/milestone/45

It would be great to get this solved and replace powershell as my main ISE.

Arrived here because the window.owner property must not be properly set because the IE login prompt window appears behind the vscode app when running Login-AzureRmAccount. Hope to see this fixed soon!

I can reproduce this with
Connect-AzureAD
from the AzureAD module. Unlike what others say, I don't find the auth dialog behind the VSCode window. I eventually have to kill the Integrated Powershell Console.

This is an electron deficiency... I am sure I linked the appropriate issues somewhere...

Found it, we link to it from other issues, but not this one, so here's the vscode issue: https://github.com/Microsoft/vscode/issues/42356

@mmascolino my goto when PowerShell spawns a login is to look for the flashing PowerShell icon in the task bar.

Oddly enough...I don't see a flashing PowerShell icon either.

Yeah, coworker doesn't get flashing PowerShell when opening a file with a file open dialog. He is however able to find it with Alt+Tab...

I can repo the flashing with:
Get-ChildItem . | Out-GridView
but with the AzureAD commandlets that launch the multifactor auth popup window doesn't flash and I also don't find it with Alt-Tab

Also still a problem with:
Connect-AzAccount
It's not a great user experience when the very first thing you try and do in VS Code is to login and it doesn't work properly. I almost decided on abandoning using VSCode, before I realised what was going on. Please fix this!

@SydneyhSmith could we get this issue labeled with vscode-issue as this is related to electron and there's nothing we can do?

Looking at the FAQ, would it be worth adding an entry to it? Perhaps something like:

**Q. Why is my window (Get-Credential, Connect-MsolService, Connect-AzAccount, Connect-AzureAd, etc) not appearing?**<br>
A. Due to an [issue](https://github.com/Microsoft/vscode/issues/42356) in electron, windows spawned by vscode do not appear above vscode.

@corbob - looks like electron also passed on owning this issue - they refer to using forcefocus as a workaround.

It does seem to be a hard problem, but from a user experience perspective we could do better - maybe we can consider using forcefocus in vscode for this use case. If this is your first user experience with vscode like @cbailiss - you are less likely to continue using the editor and shell as it doesn't work.

Visual Studio doesn't have any of these windowing issues, but it's also not electron-based.

I went ahead and updated the faq,
thanks for providing the content @corbob

FWIW: I was working with Fluent Terminal and noticed that it appears to suffer from the same issue of windows spawned by PowerShell being behind it. The really complex part I think would be trying to sort out what windows are spawned by us and then using forcefocus as @alohaninja alluded to.

Just chiming in that I'd also like this fixed. It's super annoying with out-gridview.

Was this page helpful?
0 / 5 - 0 ratings