vscode-powershell: System.Windows.Forms Dialogs Don't Open In Debugger

Please fill in these details so that we can help you!

System Details

  • Operating system name and version: Windows 10 x64
  • VS Code version: 1.8.1
  • PowerShell extension version: 0.8.0
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.0.10586.672
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.672
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

Using the below script in the debugger, the dialog window does not appear, and the debugger crashes.

function Get-FileName($initialDirectory){   
    [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |  Out-Null

    $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
    $OpenFileDialog.initialDirectory = $initialDirectory
    $OpenFileDialog.filter = "All files (*.*)| *.*"
    $OpenFileDialog.ShowDialog() | Out-Null
    $OpenFileDialog.filename
}

Attached Logs

vscode-powershell - Copy.txt EditorServices - Copy.txt

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

@SuHwak IIRC there is a bug in Electron where dialogs were showing up behind VSCode. Can you double check that the dialog you’re looking for isn’t behind VSCode.

I can’t repro the original issue. The OpenFile dialog opens for me and returns the selected file. If you have a repro post it here otherwise, I’m going to close this issue.

Hi, is there any plan to fix this? Working on a project that uses this a lot, and it is a pain switching over to ISE to debug…