Skip to content

Match BCL parameter types for TimeSpan.FromDays/FromHours/FromMinutes - #632

Merged
SimonCropp merged 2 commits into
mainfrom
fix/timespan-from-long
Oct 11, 2026
Merged

SimonCropp merged 2 commits into
mainfrom
fix/timespan-from-long

Conversation

@SimonCropp

Copy link
Copy Markdown
Owner

Bug

The multi-argument TimeSpan factory polyfills declared every parameter as int:

  • FromDays(int, int, int, int, int, int)
  • FromHours(int, int, int, int, int)
  • FromMinutes(int, int, int, int)

The BCL (net9 reference assemblies) declares:

  • FromDays(int, int, long, long, long, long)
  • FromHours(int, long, long, long, long)
  • FromMinutes(long, long, long, long)

So code passing long arguments compiled on net9+ but failed with CS1503 on every TFM that uses the polyfill, and values outside the Int32 range could not be expressed.

Fix

Parameter types (and the //Link: overload anchors) now match the BCL. The implementation already accumulated in decimal, so no other change was needed.

Coverage

  • FromDays_LongComponents, FromHours_LongComponents, FromMinutes_LongComponents tests pass long arguments, including values larger than int.MaxValue (run on net48, net8.0 and net10.0).
  • Consume.cs calls the three overloads with long arguments.
  • Split files and api_list.include.md regenerated.

@SimonCropp SimonCropp added this to the 11.4.4 milestone Oct 11, 2026
@SimonCropp
SimonCropp merged commit 4afa508 into main Oct 11, 2026
3 checks passed
@SimonCropp
SimonCropp deleted the fix/timespan-from-long branch October 11, 2026 22:12
This was referenced Oct 12, 2026
This was referenced Oct 14, 2026
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