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

Debugging hangs when Import-Excel attempts to access an open file #2969

Closed
sba923 opened this issue Sep 23, 2020 · 5 comments
Closed

Debugging hangs when Import-Excel attempts to access an open file #2969

sba923 opened this issue Sep 23, 2020 · 5 comments

Comments

@sba923
Copy link

sba923 commented Sep 23, 2020

System 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:

image

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:

image

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 #2713 (sort of endless prompt display).

Attached Logs

logs.zip

@ghost ghost added the Needs: Triage Maintainer attention needed! label Sep 23, 2020
@SydneyhSmith
Copy link
Collaborator

Thanks @sba923 for all the info... this looks like the stack trace:

System.Management.Automation.CommandNotFoundException: The term 'Out-Default' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke[T](IEnumerable input, PSInvocationSettings settings)
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Thread

Just to check, you dont have a profile which redefines out-default...correct?
It would also be great to know if when it hangs you are able to interact with the UI in any way?

@SydneyhSmith SydneyhSmith added Needs-Repro-Info and removed Needs: Triage Maintainer attention needed! labels Sep 24, 2020
@sba923
Copy link
Author

sba923 commented Sep 25, 2020

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 ;-)

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Sep 25, 2020
@SydneyhSmith SydneyhSmith added Area-Debugging Issue-Bug A bug to squash. and removed Needs: Maintainer Attention Maintainer attention needed! labels Sep 29, 2020
@SydneyhSmith
Copy link
Collaborator

This could be related to #2767

@ghost
Copy link

ghost commented Aug 19, 2021

This issue was closed automatically as repro info was indicated as needed, but there has been no activity in over a week. Please feel free to reopen with any available information!

@ghost ghost closed this as completed Aug 19, 2021
Debug/Terminal Reliability automation moved this from To do to Done Aug 19, 2021
@andyleejordan
Copy link
Member

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!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

No branches or pull requests

3 participants