Skip to content

AngouriMath.Interactive hangs the C# kernel when it loads #2108

Closed

Description

@Rafael-SOWNet

In a C# notebook, #r "nuget:AngouriMath.Interactive, *-*" never returns: the cell runs until the kernel is interrupted. Found while making the sample notebooks run in the Binder image (#2107).

Measured with jupyter nbconvert --execute in that image, which has dotnet-interactive 1.0.712001 and the .NET 10 SDK:

C# cell result
1 + 1 2, in 3 s
#r "nuget:PeterO.Numbers, 1.8.0" loads, in 4 s
#r "nuget:AngouriMath, *-*" loads with its LaTeX extension, in 5 s
#r "nuget:AngouriMath.Interactive, *-*" still running at 120 s, and at 300 s

The same reference from an F# kernel loads in 14 s. So the hang is in what AngouriMath.Interactive does when the C# kernel loads it, most likely its F# IKernelExtension; I have not narrowed it further. #2107 points the C# sample at AngouriMath, which is all it needs.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Activity

  1. added this to the 2.7.0 milestone on Oct 24, 2026
  2. Rafael-SOWNet commented on Oct 24, 2026

    @Rafael-SOWNet
    MemberAuthor

    Narrowed in the Binder image (dotnet-interactive 1.0.712001). I loaded local builds from a local feed into a C# kernel, changing one thing in each:

    variant C# kernel F# kernel
    2.6.0 as published, and an unchanged local build hangs loads
    OnLoadAsync without its printfn hangs —
    OnLoadAsync doing nothing at all hangs —
    AngouriMath's extension.dib left out of its package hangs loads
    built against Microsoft.DotNet.Interactive 1.0.0-beta.26120.1, the host's own, instead of 23611.1 hangs loads
    the DLL not packed a second time under interactive-extensions/dotnet loads, with LaTeX from extension.dib fails: Could not load file or assembly 'FSharp.Core, Version=10.1.0.0'

    Every dependency of the package loads in a C# kernel on its own, and so do all of them together.

    So neither what the extension does nor which interface version it was built against causes the hang. Its presence under interactive-extensions/dotnet does: there, a C# kernel never finishes loading it. While it hangs, dotnet-stack shows the kernel's scheduler thread in KernelScheduler.RunDeferredOperationsAndThen, blocked in Task.WaitAny, so the #r command is waiting on an operation deferred to the same kernel.

    Dropping that copy fixes C# and breaks F#. A fix has to keep the extension for F# and not offer it to C#. A note for whoever picks this up: in an F# kernel the host logs Loading extensions from …/lib/netstandard2.1/AngouriMath.Interactive.dll, not the interactive-extensions copy.

    Until then, a C# notebook needs only #r "nuget:AngouriMath, *-*", whose extension.dib gives LaTeX output. The samples do that since #2107.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

  3. moved this from Todo to In Progress in AngouriMathon Oct 24, 2026
  4. Rafael-SOWNet commented on Oct 24, 2026

    @Rafael-SOWNet
    MemberAuthor

    A correction to my comment above: the copy under interactive-extensions/dotnet went with the hang but did not cause it.

    The packages were built against FSharp.Core 10.1, and the host runs 10.0. With FSharp.Core 8.0.403, the same package layout loads in a C# kernel in 12 s and still works in F#. Rebuilt at 10.1, it times out again in the same image. So the extension doesn't need to be kept from C#. #2112 has the fix and the measurements.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

  5. moved this from In Progress to Done in AngouriMathon Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions