In F# 9, FSharpValue.GetUnionFields only returns fields for the first case of struct unions with shared fields.
Repro: Repro.zip
open Microsoft.FSharp.Reflection
[<Struct>]
type MySharedStructDu =
| A of int64
| B of int64
for value in [A 1L; B 2L] do
let caseInfo, inner = FSharpValue.GetUnionFields(value, typeof<MySharedStructDu>)
printfn $"Inner value for case %s{caseInfo.Name} is %A{inner}"
Expected behavior
Inner value for case A is [|1L|]
Inner value for case B is [|2L|]
Actual behavior
Inner value for case A is [|1L|]
Inner value for case B is [||]
Known workarounds
I don't know of any, though to be fair I haven't looked for any either.