Conversation
… Http.fs - Mark FSharp.Data.Http, FSharp.Data.Runtime.Utilities, FSharp.Data.Json.Core, FSharp.Data.Csv.Core, FSharp.Data.Xml.Core, FSharp.Data.Html.Core, and FSharp.Data.WorldBank.Core as IsTrimmable=true - Replace reflection-based reraisePreserveStackTrace in Http.fs with ExceptionDispatchInfo.Capture(e).Throw() (cleaner and trim-safe) - Remove dead runningOnMono code that used System.Type.GetType reflection - Remove now-unneeded open System.Reflection import Closes #1436 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Mar 1, 2026
dsyme
approved these changes
Mar 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated PR from Repo Assist.
Implements trimming support for all FSharp.Data runtime assemblies, allowing Blazor WASM and other trimmed deployments to reduce bundle size significantly.
Closes #1436
What changed
IsTrimmable=trueadded to all runtime Core librariesThe following NuGet packages now declare themselves as trimmable, allowing the .NET trimmer/linker to remove unused code when publishing trimmed applications (e.g. Blazor WASM):
FSharp.Data.HttpFSharp.Data.Runtime.UtilitiesFSharp.Data.Json.CoreFSharp.Data.Csv.CoreFSharp.Data.Xml.CoreFSharp.Data.Html.CoreFSharp.Data.WorldBank.CoreThe design-time assembly (
FSharp.Data.DesignTime) and the type provider host (FSharp.Data) are intentionally excluded — they only run in the compiler/IDE, not in end-user apps.Reflection removed from
Http.fsTwo reflection call sites were blocking safe trimming:
runningOnMono— thisletbinding usedSystem.Type.GetType "Mono.Runtime"to detect the Mono runtime, but was never actually used anywhere. It has been removed entirely.reraisePreserveStackTrace— previously usedtypeof(exn).GetField("_remoteStackTraceString", BindingFlags.Instance ||| BindingFlags.NonPublic)to preserve exception stack traces via a private field hack. Replaced with the standardExceptionDispatchInfo.Capture(e).Throw()API (available since netstandard1.1), which is both trim-safe and semantically superior.The
open System.Reflectionimport is also removed as it is no longer needed.Rationale
IsTrimmable=truesignals to the .NET trimmer that a library has no unsafe reflection usage and can have unreachable code stripped. Without this flag, the trimmer must preserve the entire assembly to be safe, resulting in significantly larger bundles.The
StructuralTypes.fs/StructuralInference.fsuse oftypeof(T)is trim-safe — these are compile-time constants, not dynamic lookups.Test Status
✅ Build succeeded (0 errors, pre-existing warnings only)
✅ Format check passed (fantomas)
✅ All 800 tests passed across FSharp.Data.Core.Tests, FSharp.Data.DesignTime.Tests, FSharp.Data.Tests, and FSharp.Data.Reference.Tests