Open WhiteBlackGoose opened 1 year ago
It's a problem of printf family specifically. Console.WriteLine should work. I belive there was a flag of some sort planned to F# 7 to generate reflection free code but I'm not sure I'm correct here.
A good thing to track in our aot bucket
This is currently working on my machine:
$ dotnet publish -p:SelfContained=true -p:PublishAot=true -p:IlcDisableReflection=true -o ./output
MSBuild version 17.3.2+561848881 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
fs-hello-world -> /tmp/fs-hello-world/bin/Debug/net6.0/linux-x64/fs-hello-world.dll
fs-hello-world -> /tmp/fs-hello-world/output/
$ ./output/fs-hello-world
Hello from F#
$ dotnet --version
6.0.408
This is currently working on my machine:
PublishAot doesn't do anything on .NET 6 - it was introduced in .NET 7.
Note IlcDisableReflection
is an unsupported switch: we have no intention to stop using reflection in the runtime repo. We fix the issues found by IlcDisableReflection
if the reflection use is unnecessary/avoidable, but don't go to great lengths - we're fine Won't fixing these since the mode is unsupported and we have no plans to make it supported.
This would be fixed by:
printn
rather than printfn
Repro steps
Program.fs:
Expected behavior
Prints hello world
Actual behavior