Debugging hangs when Import-Excel attempts to access an open file
See original GitHub issueSystem Details
System Details Output
### VSCode version: 1.49.1 58bb7b2331731bf72587010e943852e13e6fd3cf x64
### VSCode extensions:
alefragnani.Bookmarks@11.3.1
anseki.vscode-color@0.4.5
christian-kohler.path-intellisense@2.3.0
CoenraadS.bracket-pair-colorizer@1.0.61
Damien.autoit@1.0.5
DavidAnson.vscode-markdownlint@0.36.3
DotJoshJohnson.xml@2.5.1
forevolve.git-extensions-for-vs-code@1.1.3
Gruntfuggly.todo-tree@0.0.178
hdg.live-html-previewer@0.3.0
KnisterPeter.vscode-github@0.30.4
mathiasfrohlich.Kotlin@1.7.1
mechatroner.rainbow-csv@1.7.1
ms-dotnettools.csharp@1.23.2
ms-mssql.mssql@1.9.0
ms-python.python@2020.8.109390
ms-vscode-remote.remote-wsl@0.44.5
ms-vscode.cmake-tools@1.4.2
ms-vscode.cpptools@1.0.1
ms-vscode.powershell@2020.6.0
ms-vscode.powershell-preview@2020.9.0
msjsdiag.debugger-for-chrome@4.12.11
naco-siren.gradle-language@0.2.3
nobuhito.printcode@3.0.0
oderwat.indent-rainbow@7.4.0
platformio.platformio-ide@2.1.0
plex.vscode-protolint@0.5.0
redhat.java@0.67.0
scala-lang.scala@0.4.3
slevesque.vscode-autohotkey@0.2.2
slevesque.vscode-hexdump@1.8.1
SzczepanMejer.bgscript-support@0.1.0
twxs.cmake@0.0.17
Tyriar.lorem-ipsum@1.2.0
VisualStudioExptTeam.vscodeintellicode@1.2.10
vscjava.vscode-java-debug@0.28.0
vscjava.vscode-java-dependency@0.13.0
vscjava.vscode-java-pack@0.10.0
vscjava.vscode-java-test@0.24.2
vscjava.vscode-maven@0.24.2
yzane.markdown-pdf@1.4.4
yzhang.markdown-all-in-one@3.3.0
zxh404.vscode-proto3@0.4.2
### PSES version: 2.2.0.0
### PowerShell version:
Name Value
---- -----
PSVersion 7.0.3
PSEdition Core
GitCommitId 7.0.3
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Description
Take the following script:
$data = import-excel (join-path -Path $env:OneDriveCommercial -childpath "Documents\testfile.xlsx")
if ($null -eq $data)
{
Write-Host -ForegroundColor Red ("Import-Excel returns $null")
}
else {
Write-Host("Count: {0}" -f $data)
$data
}
If I run this script within VS Code, and Import-Excel fails because the file is open in Excel, I get:
and then VS Code hangs.
This occurs even if I set a breakpoint on the second line of the script.
Note: if the same script is run in a standard PowerShell 7.0.3 console, the script doesn’t continue execution after the first line, but the user is returned to the PowerShell prompt:
Expected Behaviour
The error should be reported, and the script should continue (or the breakpoint at the second line should be hit)
Actual Behaviour
VS Code hangs. A restart is required.
Ctrl+C won’t help because this will yield the same behavior as in https://github.com/PowerShell/vscode-powershell/issues/2713 (sort of endless prompt display).
Attached Logs
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Excel freezes when trying to access files from within Excel
Excel starts up normally enough but when I do File -> Open, Excel freezes with no error message as it tries to display...
Read more >Excel Macro hangs for a long time but never hangs during ...
Try adding a DoEvents between the Close and the message: Close #1 DoEvents MsgBox "Commands saved to: " & FName, vbInformation, "Complete".
Read more >Using LIBNAME XLSX to read and write Excel files - SAS Blogs
The XLSX libname engine in SAS allows you to read and write Microsoft Excel files in the same way that you can work...
Read more >Cannot start debug (9.5.1.1) - Forums - IBM Support
I've recently upgraded to 9.5.1.1 and today have tried to start a debug session for the first time since upgrading, and it seems...
Read more >VS2017 hangs for a long period with "Opening the File" dialog
This issue is intermittent - seems to happen most often with XAML files (XAML debugging is turned off). The first time I open...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nope, my profile doesn’t redefine
Out-Default
I think I can interact with about everything: the editor, menus, the Explorer/Search/Extensions… panes, the debug console… basically anything except for the Terminal and the Run (debugging) pane.
And I can close VS code using the top-right X 😉
Hey! There’s been a lot of changes (for better or worse) to the extension since September, 2020. Please test the latest preview extension and re-open this if it still recurs!