interactive icon indicating copy to clipboard operation
interactive copied to clipboard

#r import not working after #!language commands

Open bolte-17 opened this issue 5 years ago • 2 comments

Describe the bug

Creating a new notebook via the VSCode Interactive Notebook extension generates a notebook using the C# kernel. Switching to F# code blocks does not change the kernel specified in metadata, but instead adds a #!fsharp command at the top of each block that's not visible in VSCode.

Using #r directive to import a NuGet package in a F# code block works in VSCode. When run in a jupyter notebook, such as when sharing with Binder, the import seems to have no effect after the #!language commands, resulting in undefined type/namespace errors.

I've created a repository to reproduce the issue: https://github.com/bolte-17/Dotnet-Interactive-Nuget-Reference-Issue It's runnable via Binder: https://mybinder.org/v2/gh/bolte-17/Dotnet-Interactive-Nuget-Reference-Issue/d71f31562d0553f13917267f1e2a8c066bd5ae34

Please complete the following:

Which version of .NET Interactive are you using? 1.0.157409+69b86441f75e5663aa2c1568ae971127de9cd02e

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

bolte-17 avatar Dec 02 '20 19:12 bolte-17

Dev container and Binder dockerfiles copied from latest examples.

bolte-17 avatar Dec 02 '20 19:12 bolte-17

@bolte-17 This has been fixed and should work for you now.

If you're using this through the VS Code extension, then you won't have to do anything; it updates on its own so you'll automatically get the latest.

For your Jupyter scenarios, you'll need to update the .NET Interactive global tool and you can do that with the following:

dotnet tool update -g --add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" Microsoft.dotnet-interactive

The result of that should display something like the following:

Tool 'microsoft.dotnet-interactive' was successfully updated from version '1.0.155302' to version '1.0.160801'.

Any version of the tool after 1.0.160801 will have these changes.

brettfo avatar Dec 08 '20 22:12 brettfo