Open
Description
The linker can/should automatically remove any .NET manifest assembly resources named FSharpSignatureData.*
and FSharpOptimizationData.*
during linking.
These are only ever needed for F# compilation which doesn't happen on-device and given the aims of the linker it is reasonable to assume this data is unreachable.
My understanding is that removing these would trim about 1.5MB off the size of all applications using FSharp.Core.dll, and about 3MB off all applications using Elmish.XamarinForms.dll.
Here's an example of how the resources look in ILDASM:
.mresource public FSharpSignatureData.Elmish.XamarinForms
.mresource public FSharpOptimizationData.Elmish.XamarinForms
Thanks
Activity
nosami commentedon Jul 3, 2018
I think we need an option to preserve the resources as @praeclarum's Continuous IDE does do F# compilation on device.
That's the only app that I am aware of that might break.
dsyme commentedon Jul 3, 2018
Yes. I'm still amazed that works. We could recommend that that app bundle a private copy of FSharp.Core but I'm also ok with there being an appropriate option
radekdoulik commentedon Jul 3, 2018
We can extend the custom linker xml definition to be able to preserve resources as well and remove these by default
Numpsy commentedon Apr 24, 2025
Question: Could/Should this linker functionality be extended to strip the new compressed equivalents of these resources (which have different names?)
refs dotnet/fsharp#15605 dotnet/fsharp#17995
T-Gro commentedon Apr 28, 2025
Yes, it should.
The names which can appear in a F# assembly are:
FSharpSignatureData.*
FSharpSignatureDataB.*
FSharpSignatureCompressedData.*
FSharpSignatureCompressedDataB.*
FSharpOptimizationData.*
FSharpOptimizationDataB.*
FSharpOptimizationCompressedData.*
FSharpOptimizationCompressedDataB.*
FSharpOptimizationInfo.*
FSharpSignatureInfo.*
[the last 2 can only ever appear on FSharp.Core and has a different name for historical backwards compat reason, but then also FSharp.Core is what will be present in all compilation units]
T-Gro commentedon Apr 28, 2025
x.StartsWith("FSharpSignature") || x.StartsWith("FSharpOptimization")
Should cover all 10 possibilities.
Fix missing coverage of F# resources in linker RemoveResourcesStep
1 remaining item