Skip to content

Conversation

@pkese
Copy link
Contributor

@pkese pkese commented Jan 22, 2026

When trying to build for .NET 10, I'm getting

FSharp.Data.GraphQL/src/FSharp.Data.GraphQL.Server.AspNetCore/ServiceCollectionExtensions.fs(23,37): error FS0041: A unique overload for method 'FromMilliseconds' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: intCandidates: - TimeSpan.FromMilliseconds(milliseconds: int64) : TimeSpan - TimeSpan.FromMilliseconds(value: float) : TimeSpan [/src/submodules/FSharp.Data.GraphQL/src/FSharp.Data.GraphQL.Server.AspNetCore/FSharp.Data.GraphQL.Server.AspNetCore.fsproj::TargetFramework=net10.0]

The reason is that in .NET 9.0 TimeSpan.FromMilliseconds had 2 overloads:

  • FromMilliseconds(Int64, Int64)
  • FromMilliseconds(Double)

In .NET 10.0 there are now 3 overloads:

  • FromMilliseconds(Int64, Int64)
  • FromMilliseconds(Double)
  • FromMilliseconds(Int64)

... and F# doesn't know whether it should convert the provided int32 into an int64 or double.

This patch defaults to double which makes it compile with both .NET 9 and 10.

@xperiandri xperiandri changed the title Fix .NET 10 TimeSpan.FromMilliseconds ambiguity Fix TimeSpan.FromMilliseconds ambiguity with .NET 10 Jan 23, 2026
@xperiandri xperiandri merged commit 5492cd7 into fsprojects:dev Jan 23, 2026
3 checks passed
@xperiandri
Copy link
Collaborator

Thank you for the contribution!
Do you need 3.0.1/3.1.0 release?

@pkese pkese deleted the net10-fix branch January 23, 2026 16:54
@pkese
Copy link
Contributor Author

pkese commented Jan 23, 2026

@xperiandri

Do you need 3.0.1/3.1.0 release?

No, I'm good. I'm running on my own fork of the repo with some extra stuff added.

Btw, thanks for the time and effort you're investing in maintaining this library. It's really amazing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants