interactive icon indicating copy to clipboard operation
interactive copied to clipboard

Saving then re-opening .dib file merged separate cells and broke notebook

Open pshelton-skype opened this issue 1 year ago • 3 comments

Describe the bug

I created an DotNet Interactive notebook that included separate cells running different Kusto queries within the same kernel. After saving and re-opening the notebook, five different cells (including one CSharp and four Kusto cells) running different queries were merged into one large CSharp cell with repetitive #!kql-KustoKernel magic declarations interspersed between the query logic.

Several other Kusto cells at the end after some Markdown content are all formatted as Markdown and not a Markdown cell followed by Kusto cells.

This obviously completed destroys the behavior of the notebook and is equivalent to data loss as I have to go re-format most of the cell content in the notebook.

Please complete the following:

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

.NET Interactive © 2020 Microsoft Corporation Version: 1.0.522904+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074 Library version: 1.0.0-beta.24229.4+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074 Build date: 2024-10-27T19:31:09.0232372Z

  • OS
    • [X] Windows 11
    • [ ] Windows 10
    • [ ] macOS
    • [ ] Linux (Please specify distro)
    • [ ] iOS
    • [ ] Android
  • Browser
    • [ ] Chrome
    • [X] Edge
    • [ ] Firefox
    • [ ] Safari
  • Frontend
    • [ ] Jupyter Notebook
    • [ ] Jupyter Lab
    • [ ] nteract
    • [X] Visual Studio Code
    • [ ] Visual Studio Code Insiders
    • [ ] Visual Studio
    • [ ] Other (please specify)

Screenshots

Image Image

pshelton-skype avatar Oct 27 '24 21:10 pshelton-skype

Did the combined cell not work correctly? The .dib format is a plain text format and the #!kql-KustoKernel magic commands are in effect "cell" separators. They should run, although there's no way to run them individually without splitting them back out into separate cells.

Here's an example:

Image

jonsequitur avatar Oct 28 '24 22:10 jonsequitur

One of the merged cells that only contained KQL did work, but the second screenshot shows that it merged one Markdown and several KQL cells and thus the KQL cells aren't executable, they're just display content. That was the most remarkable bug.

pshelton-skype avatar Oct 28 '24 23:10 pshelton-skype

Thanks. I didn't really understand what was going on in that screenshot.

I think what's going on here is that everything is treated as Markdown after we see a #!markdown magic command, and even if the #!markdown magic command comes after other code, it emits the whole cell as Markdown. That is definitely a bug but it's unrelated to the file format.

Image

jonsequitur avatar Oct 29 '24 01:10 jonsequitur