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.86k stars 381 forks source link

Outputs from dotnet-repl are not displayed in by VS Code extension #3335

Open nhirschey opened 9 months ago

nhirschey commented 9 months ago

Describe the bug

I execute a notebook using dotnet-repl, but the outputs do not show up in VS Code notebook extension viewer. cc: @jonsequitur

This has come up in the effort to allow polyglot notebooks as input for writing library documentation using FSharp.Formatting.

Specifically, I run dotnet repl --run .\docs\literate-notebook.ipynb --exit-after-run --default-kernel fsharp --output-path .\docs\literate-notebook.ipynb.

When I open the notebook in VS Code the outputs are not displayed, yet if I open the file in text mode I can see the outputs there for the cell. Notebook gist here. Screensot of notebook in vs code below

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):

Screenshots

If applicable, add screenshots to help explain your problem.

image

marckruzik commented 9 months ago

I have the same problem. I'm giving more information to help.

I used dotnet-repl for a C# .dib notebook. dotnet repl --run test.dib --exit-after-run --output-path output.ipynb When I load the output.ipynb file, the output cells are cleared.

I made an animation showing the problem with a 22 Kb ipynb file: bug_disappear

This procedure has a few extra steps to reproduce the bug each time: I also create a blank new document before closing the ipynb file, then the blank document, then VS Code. Because if I just close the ipynb file and reopens it, the ipynb file is reopened with the cells already cleared (maybe because of a cache). By following the steps above, the bug can be reproduced each time.

Also, after the cells output have been cleared, the ipynb document is considered as modified. If I save it using Save As, the file is smaller (from 22 Kb to 10 Kb).

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):

Version: 1.0.456201+e5dc02dbdc933d895d722e69bfa98d580dcda8d9

jonsequitur commented 7 months ago

This problem isn't specific to dotnet-repl. The same behavior is exhibited with files saved using Jupyter Lab.

This appears to be a regression in VS Code.