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.8k stars 374 forks source link

re-entrant commands with F# kernel fails #3049

Open colombod opened 1 year ago

colombod commented 1 year ago

Describe the bug

Submitting a re-entrant command to F# kernel fails

let reentrant() =
    async {
        let! _ = SubmitCode("""let b = $"{a} re-entrant" """, "fsharp") |> Kernel.Root.SendAsync |> Async.AwaitTask
        return ()
    } |> Async.RunSynchronously

then

reentrant()

output

Error: input.fsx (1,1)-(1,1) interactive error internal error: The thread is already executing the ControlledExecution.Run method.

Please complete the following:

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

Screenshots

image
colombod commented 1 year ago

@KevinRansom will the fix be included in the 43.7.400 release?

jonsequitur commented 1 year ago

@colombod Is there an external issue this should reference?

KevinRansom commented 6 months ago

You guys now own the ControlledExecution, we don't set it when we are invoked with the --noninteractive

KevinRansom commented 6 months ago

It rtm'd in this package : https://www.nuget.org/packages/FSharp.Compiler.Service/43.7.400. It also previewed as I recall. It previewed with this package: https://www.nuget.org/packages/FSharp.Compiler.Service/43.7.400-preview.23281.1

Interactive main has been using this package since august: https://github.com/dotnet/interactive/blame/8833ceb75fb093d9879de7fbccb7ecf867aa5687/Directory.Build.targets#L38