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

New code cells in F# default notebook are missing metadata, are treated as C# #3544

Open
3 tasks done
FH-Inway opened this issue May 5, 2024 · 1 comment
Open
3 tasks done
Labels

Comments

@FH-Inway
Copy link

FH-Inway commented May 5, 2024

Describe the bug

I mainly write notebooks for F# and PowerShell, with the occasional C# cell in the mix. The default notebook language setting is set to fsharp.

The last few times I worked with the notebooks, I noticed that new code cells show in the top bottom corner my default language setting "fsharp - F# Script Code". However, if valid F# code is entered in the cell, it gets a lot of red squiggles (screenshot 1). When executing the cell, there are a lot of CS errors, indicating that the code is treated as C# (screenshot 2).

When I open the notebook in a text editor, I see that the metadata node of the cell is empty. Other working cells have metadata indicating F# in there (screenshot 3). See also a gist of the file in that state: https://gist.github.com/FH-Inway/34984cfacc39b27e206873048a16fb3e?short_path=51a4666

When I explicitely set the code cell via the language selector in the bottom right corner to F#, all is well again.

When I close a notebook with such an "invalid" cell, it is opened again right away, showing unsaved changes. The cell can now be executed successfully and after saving the file, the cell shows F# metadata.

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):
Version: 1.0.522904+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074
Library version: 1.0.0-beta.24229.4+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074
Build date: 2024-05-05T09:37:02.5479468Z

  • OS
    • Windows 11
  • Browser
    • Edge
  • Frontend
    • Visual Studio Code

Screenshots

Screenshot 2024-05-05 121358

Screenshot 2024-05-05 121414

Screenshot 2024-05-05 121443

@Snozzberries
Copy link

Seeing same issue with PowerShell cells.

  1. New polyglot notebook as PowerShell
  2. In first code cell, already tagged as pwsh, run a command
  3. Receive error The state of the current PowerShell instance is not valid for this operation.
  4. Manually set the cell tag to pwsh, command runs as expected
  5. Save file
  6. Restart kernel
  7. All cells that weren't manually tagged reset to C#

I downgraded to a few versions back to 1.0.4403* and saw similar results, though in the current version the save file retains the notebook level metadata, in those older versions even that would go away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants