From 1ad8a704e1e5e0ca8440a417ad6471b8f70895e5 Mon Sep 17 00:00:00 2001 From: Repo Assist Date: Sun, 1 Mar 2026 01:37:06 +0000 Subject: [PATCH 1/2] Add IsTrimmable=true to runtime Core libraries; replace reflection in 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> --- RELEASE_NOTES.md | 1 + .../FSharp.Data.Csv.Core.fsproj | 1 + .../FSharp.Data.Html.Core.fsproj | 1 + src/FSharp.Data.Http/FSharp.Data.Http.fsproj | 1 + src/FSharp.Data.Http/Http.fs | 20 +++---------------- .../FSharp.Data.Json.Core.fsproj | 1 + .../FSharp.Data.Runtime.Utilities.fsproj | 1 + .../FSharp.Data.WorldBank.Core.fsproj | 1 + .../FSharp.Data.Xml.Core.fsproj | 1 + 9 files changed, 11 insertions(+), 17 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index b11f90d87..0d3fb92f6 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -8,6 +8,7 @@ - Make `Http.AppendQueryToUrl` public (closes #1325) - Add `PreferOptionals` parameter to `JsonProvider` and `XmlProvider` (defaults to `true` to match existing behavior; set to `false` to use empty string or `NaN` for missing values, like the CsvProvider default) (closes #649) - Add `UseSchemaTypeNames` parameter to `XmlProvider`: when `true` and `Schema` is provided, multiple elements sharing the same XSD complex type generate a single F# type (named after the XSD type) instead of separate per-element types (closes #1488) +- Mark all runtime Core libraries as trimmable (`IsTrimmable=true`); replace reflection-based stack-trace preservation in `Http.fs` with `ExceptionDispatchInfo`, and remove dead Mono-detection code (closes #1436) ## 8.0.0 - Feb 25 2026 diff --git a/src/FSharp.Data.Csv.Core/FSharp.Data.Csv.Core.fsproj b/src/FSharp.Data.Csv.Core/FSharp.Data.Csv.Core.fsproj index 5842bd902..eea7b85df 100644 --- a/src/FSharp.Data.Csv.Core/FSharp.Data.Csv.Core.fsproj +++ b/src/FSharp.Data.Csv.Core/FSharp.Data.Csv.Core.fsproj @@ -9,6 +9,7 @@ logo.png true + true diff --git a/src/FSharp.Data.Html.Core/FSharp.Data.Html.Core.fsproj b/src/FSharp.Data.Html.Core/FSharp.Data.Html.Core.fsproj index 5f7a92c5d..586736dd3 100644 --- a/src/FSharp.Data.Html.Core/FSharp.Data.Html.Core.fsproj +++ b/src/FSharp.Data.Html.Core/FSharp.Data.Html.Core.fsproj @@ -9,6 +9,7 @@ logo.png true + true $(DefineConstants);HIDE_REPRESENTATION diff --git a/src/FSharp.Data.Http/FSharp.Data.Http.fsproj b/src/FSharp.Data.Http/FSharp.Data.Http.fsproj index 4db24a53d..5d0c13d80 100644 --- a/src/FSharp.Data.Http/FSharp.Data.Http.fsproj +++ b/src/FSharp.Data.Http/FSharp.Data.Http.fsproj @@ -9,6 +9,7 @@ logo.png true + true diff --git a/src/FSharp.Data.Http/Http.fs b/src/FSharp.Data.Http/Http.fs index 3b9b8ed81..8cc2f09c0 100644 --- a/src/FSharp.Data.Http/Http.fs +++ b/src/FSharp.Data.Http/Http.fs @@ -11,8 +11,8 @@ open System.Net open System.Text open System.Text.RegularExpressions open System.Threading -open System.Reflection open System.Runtime.CompilerServices +open System.Runtime.ExceptionServices open System.Runtime.InteropServices /// The method to use in an HTTP request @@ -1607,12 +1607,6 @@ module internal HttpHelpers = source.Dispose() } - let runningOnMono = - try - not (isNull (System.Type.GetType "Mono.Runtime")) - with e -> - false - let writeBody (req: HttpWebRequest) (data: Stream) = async { if data.CanSeek then @@ -1624,16 +1618,8 @@ module internal HttpHelpers = } let reraisePreserveStackTrace (e: Exception) = - try - let remoteStackTraceString = - typeof.GetField("_remoteStackTraceString", BindingFlags.Instance ||| BindingFlags.NonPublic) - - if not (isNull remoteStackTraceString) then - remoteStackTraceString.SetValue(e, e.StackTrace + Environment.NewLine) - with _ -> - () - - raise e + ExceptionDispatchInfo.Capture(e).Throw() + raise e // unreachable; satisfies type checker let augmentWebExceptionsWithDetails f = async { diff --git a/src/FSharp.Data.Json.Core/FSharp.Data.Json.Core.fsproj b/src/FSharp.Data.Json.Core/FSharp.Data.Json.Core.fsproj index 4d5e20089..1172905b8 100644 --- a/src/FSharp.Data.Json.Core/FSharp.Data.Json.Core.fsproj +++ b/src/FSharp.Data.Json.Core/FSharp.Data.Json.Core.fsproj @@ -9,6 +9,7 @@ logo.png true + true diff --git a/src/FSharp.Data.Runtime.Utilities/FSharp.Data.Runtime.Utilities.fsproj b/src/FSharp.Data.Runtime.Utilities/FSharp.Data.Runtime.Utilities.fsproj index ca1f777e6..f1b5fa927 100644 --- a/src/FSharp.Data.Runtime.Utilities/FSharp.Data.Runtime.Utilities.fsproj +++ b/src/FSharp.Data.Runtime.Utilities/FSharp.Data.Runtime.Utilities.fsproj @@ -9,6 +9,7 @@ logo.png true + true diff --git a/src/FSharp.Data.WorldBank.Core/FSharp.Data.WorldBank.Core.fsproj b/src/FSharp.Data.WorldBank.Core/FSharp.Data.WorldBank.Core.fsproj index 15294a60a..6401f6300 100644 --- a/src/FSharp.Data.WorldBank.Core/FSharp.Data.WorldBank.Core.fsproj +++ b/src/FSharp.Data.WorldBank.Core/FSharp.Data.WorldBank.Core.fsproj @@ -9,6 +9,7 @@ logo.png true + true diff --git a/src/FSharp.Data.Xml.Core/FSharp.Data.Xml.Core.fsproj b/src/FSharp.Data.Xml.Core/FSharp.Data.Xml.Core.fsproj index ee5175882..be69e732b 100644 --- a/src/FSharp.Data.Xml.Core/FSharp.Data.Xml.Core.fsproj +++ b/src/FSharp.Data.Xml.Core/FSharp.Data.Xml.Core.fsproj @@ -9,6 +9,7 @@ logo.png true + true From 39b61e01569914e57942f230f141f616c58ac8c4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 1 Mar 2026 01:39:34 +0000 Subject: [PATCH 2/2] ci: trigger CI checks