dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.82k stars 772 forks source link

`PublishTrimmed` or `PublishAot` should imply `ReflectionFree` #17361

Closed baronfel closed 1 day ago

baronfel commented 2 days ago

Is your feature request related to a problem? Please describe.

Most docs for doing AOT say "Set PublishTrimmed or PublishAOT and then you're all set". That's not quite the case for F# - currently you also have to set ReflectionFree to true to tell the compiler to codegen without using reflection where possible.

Describe the solution you'd like

This is a pain, and we should condition ReflectionFree on these two properties so it Just Works.

baronfel commented 1 day ago

Going to close this because ReflectionFree isn't the right approach here - Reflection can be used with AOT if property annotated, and @KevinRansom has broadly done that in the compiler and corelib already. Any gaps should be treated as bugs to address and users can use ReflectionFree as a temporary workaround for those specific scenarios.