You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
System.Windows.Forms Dialogs Don't Open In Debugger #410
A little more info... I changed the code to this (using Add-Type instead of [System.Reflection...]) and debugged through it... it won't progress past the ".ShowDialog()" and never actually shows the dialog.
A suggestion for fixing this (maybe a quick fix?)... for C# projects, there is an attribute in the launch.json called externalConsole (see screenshot below) that allows you to debug in an external window. Not sure if that would be possible for powershell, but maybe worth looking at.
Unfortunately this setting will not make a difference, it's more of an issue with the code in our debug adapter. I still haven't got a chance to look at this but I will as soon as I ship 0.9.0. Sorry for the delay!
I think sunmorgus has a reasonable idea. You can work-around this by launching your script in an external console with a Wait-Debugger at the start, use VSCode to attach to the process and then debug it. However, we should provide an easier way to do this i.e. debug via a new, external console.
I am in the process of moving over from ISE to VS Code (to leverage git), only to come across this problem. Keith Hill (@rkeithhill) Do you have a step-by-step for me?
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.
Below is the code I'm working with (mostly not my own), which works great in PowerShell_ISE, as well as a regular PS prompt.
I just found that if debugging with the option to "Launch current file in temporary console" it works too, however, when using the default "Launch current file" it executes in the integrated console and it just hangs indefinitely.
Using the temporary console doesn't work for debugging blocks or lines of code of course.
Is there a logfile for VS Code? I'm running the latest version 1.24.0 on Windows 10 1803.
The other way to do it is to go into VSCode and use Ctrl+Shift+P to bring up the VSCode command palette. In there, if you type "logs" you should get presented with an option like "PowerShell: Open PowerShell Extension Logs Folder". That will open the folder up for you in VSCode.
Thank you Rob Holt (@rjmholt), however, the logs don't show anything because the console just hangs (probably waiting for the result), and I have to force close the terminal. Any other suggestions?
SuHwak (@SuHwak) the logs should exist if the integrated console started — are you saying there are no logs at all, or that they just drop off when you run the hanging code and there's no further info?
SuHwak (@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.
Rob Holt (@rjmholt) @tylerl0706 It was indeed hiding stealthily behind VS Code window all that time. It didn't create a taskbar item either or else I would have noticed earlier! Thank you, I can now revert back (thanks to Git) :)
Activity
daviwil commentedon Dec 22, 2016
Hmm, haven't seen this before. I'll take a look!
sunmorgus commentedon Jan 3, 2017
A little more info... I changed the code to this (using Add-Type instead of [System.Reflection...]) and debugged through it... it won't progress past the ".ShowDialog()" and never actually shows the dialog.
I do know that some of the windows forms stuff works, because I can use the below code to pop up a message balloon:
sunmorgus commentedon Jan 18, 2017
A suggestion for fixing this (maybe a quick fix?)... for C# projects, there is an attribute in the launch.json called externalConsole (see screenshot below) that allows you to debug in an external window. Not sure if that would be possible for powershell, but maybe worth looking at.
daviwil commentedon Jan 18, 2017
Unfortunately this setting will not make a difference, it's more of an issue with the code in our debug adapter. I still haven't got a chance to look at this but I will as soon as I ship 0.9.0. Sorry for the delay!
19 remaining items
rkeithhill commentedon Mar 20, 2018
I think sunmorgus has a reasonable idea. You can work-around this by launching your script in an external console with a
Wait-Debuggerat the start, use VSCode to attach to the process and then debug it. However, we should provide an easier way to do this i.e. debug via a new, external console.SuHwak commentedon Jun 12, 2018
I am in the process of moving over from ISE to VS Code (to leverage git), only to come across this problem. Keith Hill (@rkeithhill) Do you have a step-by-step for me?
rkeithhill commentedon Jun 13, 2018
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.
SuHwak commentedon Jun 13, 2018
Below is the code I'm working with (mostly not my own), which works great in PowerShell_ISE, as well as a regular PS prompt.
I just found that if debugging with the option to "Launch current file in temporary console" it works too, however, when using the default "Launch current file" it executes in the integrated console and it just hangs indefinitely.
Using the temporary console doesn't work for debugging blocks or lines of code of course.
Is there a logfile for VS Code? I'm running the latest version 1.24.0 on Windows 10 1803.
rjmholt commentedon Jun 13, 2018
SuHwak (@SuHwak) you should be able to find the log files by following these instructions.
The other way to do it is to go into VSCode and use Ctrl+Shift+P to bring up the VSCode command palette. In there, if you type "logs" you should get presented with an option like "PowerShell: Open PowerShell Extension Logs Folder". That will open the folder up for you in VSCode.
SuHwak commentedon Jun 14, 2018
Thank you Rob Holt (@rjmholt), however, the logs don't show anything because the console just hangs (probably waiting for the result), and I have to force close the terminal. Any other suggestions?
rjmholt commentedon Jun 14, 2018
SuHwak (@SuHwak) the logs should exist if the integrated console started — are you saying there are no logs at all, or that they just drop off when you run the hanging code and there's no further info?
TylerLeonhardt commentedon Jun 14, 2018
SuHwak (@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.
SuHwak commentedon Jun 15, 2018
Rob Holt (@rjmholt) @tylerl0706 It was indeed hiding stealthily behind VS Code window all that time. It didn't create a taskbar item either or else I would have noticed earlier! Thank you, I can now revert back (thanks to Git) :)
TylerLeonhardt commentedon Jun 15, 2018
Here's the issue on VSCode.
You may want to reply in that issue that this is the case.
Im going to close this in favor of that since there's nothing we can do. If you think we do have a problem here, feel free to reach out!