`sprintf "%b" bool` causes AOT failure
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
`sprintf "%b" true` does not work in AOT context; nor does `sprintf "%O" true`. This affects linux-x64 8.0.401 and v9 preview 1, but not osx-arm64 8.0.300, in my testing.
**Repro steps**
In an executable with `true`:
```fsharp
let s = sprintf "%O" true // or "%b"
System.Console.WriteLine s
```
**Expected behavior**
Program prints "true".
**Actual behavior**
```
System.NotSupportedException: 'Microsoft.FSharp.Core.PrintfImpl+Specializations`3[Microsoft.FSharp.Core.Unit,System.String,System.String].CaptureFinal1[System.Boolean](Microsoft.FSharp.Core.PrintfImpl+Step[])' is missing native code.
```
**Known workarounds**
`(fun s -> $"%O{s}") true` works, as does `x.ToString () |> sprintf "%s"`.
**Related information**
Reproduced on linux-x64 with net8.0.401 and net9 preview 7, but *not* osx-arm64 8.0.300.
Contributor guide
Assessment
This issue has not been assessed yet.