Skip to content

[Feature request]: Request to update Microsoft.Extensions.Options version in Polly 8.4.1 #2382

Closed as not planned

Description

@joyf15

Is your feature request related to a specific problem? Or an existing feature?

We’re experiencing a recurring issue where tests fail due to the exception:
System.InvalidCastException: Unable to cast object of type 'System.TimeSpan' to type 'System.String'.

This issue was previously identified and resolved in Microsoft.Extensions.Options version 8.0.2 (see dotnet/extensions#4917). However, Polly version 8.4.1 still references Microsoft.Extensions.Options version 8.0.0, as noted in its Directory.Packages.props file (link to Polly’s repo).

Would it be possible to bump the Microsoft.Extensions.Options package version in Polly to 8.0.2 to avoid these errors? This update would resolve the exception issue for many tests in our suite. Thanks for considering this request

Describe the solution you'd like

Bump the Microsoft.Extensions.Options package version in Polly to 8.0.2

Additional context

N/A

Activity

  1. martincostello commented on Nov 13, 2024

    @martincostello
    Member

    Raising this requirement may cause issues for others. We typically use the lowest possible version we can for API surface (rather than behaviour) to make Polly as widely compatible with its users as possible.

    As such, I'm not inclined to not make this change on the basis that you can fix it yourself by adding an explicit package reference for Microsoft.Extensions.Options@8.0.2 or later to your own test suite to pick up the bug fix. This is true of almost any dependency in any library - there is no need to ask the lowest building block of a dependency hierarchy to update a version in most cases to suit the needs of an arbitrary consumer at the top of the dependency hierarchy.

    Polly 8.5.0 depends on newer versions if you target .NET 9, so another fix is to update Polly and .NET to the latest versions, which will also resolve your issue.

  2. mgasparel commented on Jun 12, 2025

    @mgasparel

    In case anyone comes looking, this was fixed in 8.5.1 in #2428

  3. added this to the v8.5.1 milestone on Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions