You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make.Fs: a namespaced case with a record payload fails at run time (cast to Target) #10
A nested union (a namespace) whose case carries a record payload shows correct help but fails when the target runs: Unable to cast object of type 'Status' to type 'Target'. A namespace case without a payload works, and so does a top-level case with a record.
$ ./build.fsx snap review
review
$ ./build.fsx snap status --json
[make] Target 'snap/status' failed: Unable to cast object of type 'Status' to type 'Target'.
snap status with no flag fails the same way. build snap --help and build snap status --help list the target and its --json option correctly.
Expected
snap status --json binds Json = true like test --filter x does at the top level, so a namespace can group targets that take options, for example snap accept <keys> --all, journeys live <site> --only x and site build.
Impact
The only workaround is to flatten each case to the top level (SnapStatus, which becomes snap-status), which loses the namespace in the help and in the generated mise task names (snap:status).
dotnet fsi repro.fsx snap review runs and prints review.
dotnet fsi repro.fsx snap status --json and snap status both fail:
System.InvalidCastException: Unable to cast object of type 'Status' to type 'Target'.
at Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicFunctions.UnboxGeneric[T](Object source)
at Nullean.Runna.Fs.FsGraphBuilder.FsTargetSource`1.Nullean.Runna.Execution.ITargetSource.Describe(TargetNode node, Object value)
at Nullean.Runna.Execution.RunPlan.Builder.Visit(DepRef reference, Boolean isRoot, IReadOnlyList`1 waitFor)
at Nullean.Runna.Execution.RunPlan.Build(IReadOnlyList`1 roots, ITargetSource source, PlanOptions options)
So FsTargetSource.Describe unboxes the value of a nested case to the root Target type. Argh itself is not involved.
Activity
Mpdreamz commentedon Nov 26, 2026
Still reproduces on
Runna.Fs0.2.0, the successor toNullean.Make.Fs. This is the original script with the package and namespace swapped:dotnet fsi repro.fsx snap reviewruns and printsreview.dotnet fsi repro.fsx snap status --jsonandsnap statusboth fail:So
FsTargetSource.Describeunboxes the value of a nested case to the rootTargettype. Argh itself is not involved.Fix namespaced F# case with a record payload failing at run time (#11)