Repository navigation
Remove FSharp.Core compile-time dependency from Marten - #4232
Merged
Merged
Conversation
Replace all direct FSharpOption<T> type references with reflection-based equivalents via new FSharpTypeHelper static class. F# support still works when FSharp.Core is present at runtime (loaded by F# consuming projects), but Marten.dll no longer has a hard dependency on it. Changes: - New FSharpTypeHelper.cs: lazy reflection-based FSharpOption type resolution - StoreOptions.Identity.cs: use FSharpTypeHelper for type construction - StoreOptions.MemberFactory.cs: use FSharpTypeHelper for type checks - ConstantExpressionExtensions.cs: use FSharpTypeHelper for option detection - DocumentStore.cs: remove unused Microsoft.FSharp.Control import - Delete FSharpOptionValueTypeMember.cs (replaced by ValueTypeMember<,> construction via MakeGenericType) - Remove FSharp.Core PackageReference from Marten.csproj - Add FSharp.Core to test projects that share Compile includes from Marten.Testing (previously inherited transitively via Marten) 66/66 F# tests pass (42 LINQ + 24 ValueType). Compiled Marten.dll has zero FSharp.Core references. Closes #3981 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jeremydmiller
force-pushed
the
fix/3981-remove-fsharp-dependency
branch
from
April 6, 2026 19:05
6b124d8 to
a1388fb
Compare
This was referenced Apr 7, 2026
This was referenced May 11, 2026
This was referenced May 14, 2026
This was referenced May 25, 2026
This was referenced Jun 8, 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.
Summary
FSharp.CorePackageReference fromMarten.csprojFSharpOption<T>type references with reflection-based equivalents via newFSharpTypeHelperstatic classCloses #3981
What Changed
FSharpTypeHelper.cs— lazyType.GetType("Microsoft.FSharp.Core.FSharpOption\1, FSharp.Core")` resolutionStoreOptions.Identity.cs—RegisterFSharpOptionValueTypes()usesMakeFSharpOptionType()instead oftypeof(FSharpOption<Guid>)etc.StoreOptions.MemberFactory.cs— type checks useFSharpTypeHelperinstead of direct type referencesConstantExpressionExtensions.cs—IsFSharpOptionType()replacestypeof(FSharpOption<>)comparisonFSharpOptionValueTypeMember.cs— deleted (empty class, replaced by directValueTypeMember<,>.MakeGenericType())DocumentStore.cs— removed unusedusing Microsoft.FSharp.ControlTest plan
Marten.dllhas zero FSharp.Core assembly references🤖 Generated with Claude Code