Extension scripts fail when imported from F# context (or written in F# and imported from C# context) #1808
Labels
Area-F#
Specific to F#
Area-Packages and Extensions
Related to acquiring and using packages and extensions
bug
Something isn't working
Impact-Medium
Preface: I recently got inspired to try F# again when I learned that this tool exists (and overall I guess you're doing a great job). Thus I am sorry if I use the terminology I haven't grokked yet incorrectly, or even if some things I expect to work are actually incongruent with the tool as it is now.
Bug description
Referencing packages with extension scripts from F# context execution block
What I expected: If you reference an assembly (i.e., NuGet package of the RandomNumber extension from dotnet/interactive
samples/extension/RandomNumber
) with extension script from an F# context execution block,#r
succeds and extension scripts works normally.What I got: The namespaces are inaccessible whether the extension script is written in F# or C#. (In the RandomNumber example you get CS0246 for "types/namespaces"
RandomNumberExtension
andRandomNumberGenerator
, and so no commands are registered.Referencing packages with F# extension scripts from C# context execution block
What I expected: You can use the magic commands written in F# when working from C# mode.
What I got:
DotNet
(inMicrosoft.DotNet.Interactive
) and thusKernelInvocationContext
are inaccessible from the F# script invoked from running#r
in C#-mode, which thus fails to typecheck.Steps to reproduce
With a NuGet-available package
The only one I found is
Interactive.Journey
from this same repo.So, the minimal reproduction of the bug is to run:
which fails with CS0234, as demonstrated on the picture attached
While the same
#r
command in#!csharp
mode executes the extension script successfully.Other reproductions
The same behaviour can be observed (and debugged a bit more easily) with the RandomNumber extension from dotnet/interactive
samples/extension/RandomNumber
.If you add the following to the beginning of the
extension.dib
of the RandomNumber extension:and try to import the RandomNumber package from either F# or C# contexts, F# invocation will fail with F# typecheck error around RandomNumberExtension, while C# invocation will fail with F# typecheck error around
DotNet
.Environment info
Windows 10:
Binder: started from link from the
docs/NotebooksOnBinder.md
Things that look tangentially relevant
Issue #1307
Also probably the fact about split of C# and F# kernels, as described in
variable-sharing.md
Since I performed most of the experiments locally, not to clutter screenshots with non-English compiler output, the only picture attached is the reproduction in Binder.

The text was updated successfully, but these errors were encountered: