dotnet / interactive

.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
MIT License
2.89k stars 387 forks source link

Some commands (GIT , AZ) hang when using the dotnet interactive kernel in VS Code but are OK with the .net(powershell) on in VSCode or Jupyter. #1546

Open jhoneill opened 3 years ago

jhoneill commented 3 years ago

This may need to be logged as a VSCode problem, but because the behaviour seems to be different between two dotnet interactive kernels I'm starting here

Describe the bug

An advantage of having PowerShell as a supported environment in notebooks the ability to run any command line and capture its output. For example a powershell cell can contain

ping  localhost

I have been been using this to create a shared notebook of useful git examples. With combination of anaconda / Jupyter and the .NET (PowerShell) kernel,

git status

and similar work. Doing the same in VSCode fails with the default kernel. The command will hang indefinitely, and usually clicking the stop button returns
Error: System.OperationCanceledException: Command :SubmitCode: git status cancelled. but I have seen this return the output (rarely).
But I can switch kernels and get it to work. (See screen shots.) I'd like to use the notebooks on machines without the python / jupyter bits (only with VSCode) so this is only a partial solution.

It does not affect all commands "Net share" , "ping", "Ipconfig" "nslookup google.com", "Tasklist" all work, so Initially I thought this was something specific to git.exe but "az -h" has the same problem

I've also tried running the command as a job with Start-Job {git status} | wait-job | receive-job but this gives the error

Start-Job: The pwsh executable cannot be found at "C:\Users\P10506111\.nuget\packages\microsoft.dotnet-interactive\1.0.240403\tools\net5.0\any\runtimes\win\lib\net5.0\pwsh.exe".
Note that 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted in other applications.

And by trying to remote to a PSSession on my machine with
$pss = New-PSSession -ComputerName localhost -EnableNetworkAccess gives
New-PSSession: [localhost] An error has occurred which PowerShell cannot handle. A remote session might have ended.

From the message the first looks to be by design, I can't tell if the second is design, bug or user error - they fail in both kernels. I have also tried creating a PS Runspace to run the command in the default kernel - no joy with that either.

Please complete the following:

Which version of .NET Interactive are you using? There are a few ways to find this out: Version: 1.0.240403+56a0e392fba305af06e72ce7dec885b2b6722c00 Build date: 2021-08-09T11:46:14.5291024Z

Screenshots

image

image

jhoneill commented 3 years ago

I had forgotten that I had already raised this as https://github.com/dotnet/interactive/issues/970 I'm going to close that one as this is a better description and relates to how VSCode and Dot net interactive stand now

InTEGr8or commented 3 years ago

I am also seeing this on aws and az commands, such as aws --version

jonsequitur commented 3 years ago

@daxian-dbw Any ideas?

dfinke commented 3 years ago

I set up interactive notebooks in GitHub Codespaces, git status worked. On my local box, git status hangs.

image

daxian-dbw commented 3 years ago

@jonsequitur No, not sure what is going on. I tried with Jupyter notebook + latest stable version of Microsoft.dotnet-interactive global tool, and git status does work in it. What are the differences between dotnet-interactive running in VSCode and in Jupyter notebook?

@dfinke How did you install .NET Interactive Notebook in GitHub codespace? It says "not available in VS Code Web" for me:

image


dfinke commented 3 years ago

@daxian-dbw it's only available in Codespaces "proper", not the github.dev version.

jonsequitur commented 3 years ago

This looks to me like a VS Code messaging issue. The command appears to complete once you trigger another command, e.g. running another cell or even hovering somewhere that triggers a hover text request:

issue 1546

@brettfo

brianary commented 2 years ago

👉 Making edits to the cell causes the command I/O to progress, either typing or deleting characters:

dotnet-interactive-az-cli