Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflection on TimeSpan.FromSeconds needs to specify the parameter types #364

Open
tarekgh opened this issue Nov 26, 2024 · 2 comments · May be fixed by #365
Open

Reflection on TimeSpan.FromSeconds needs to specify the parameter types #364

tarekgh opened this issue Nov 26, 2024 · 2 comments · May be fixed by #365

Comments

@tarekgh
Copy link

tarekgh commented Nov 26, 2024

The TimeSpan type includes the method FromSeconds(double), and in .NET 9.0, a new overload FromSeconds(long) was introduced. The reflection logic for FromSeconds needs to be updated to specify the exact parameter types. Without this fix, the code will throw exceptions such as:

 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
  ---> Jil.DeserializationException: The type initializer for 'Jil.Deserialize.InlineDeserializer`1' threw an exception.
  ---> System.TypeInitializationException: The type initializer for 'Jil.Deserialize.InlineDeserializer`1' threw an exception.
  ---> System.Reflection.AmbiguousMatchException: Ambiguous match found for 'System.TimeSpan System.TimeSpan FromSeconds(Int64)'.
    at System.RuntimeType.GetMethodImplCommon(String name, Int32 genericParameterCount, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)
    at System.Type.GetMethod(String name, BindingFlags bindingAttr)
    at Jil.Deserialize.InlineDeserializer`1..cctor()
@tarekgh
Copy link
Author

tarekgh commented Nov 26, 2024

@kevin-montrose could you please give this issue a priority? some users are already broken when using Jil on .NET 9.0. Look this issue reported back in July too #363.

CC @Mutuduxf

@tarekgh tarekgh linked a pull request Nov 26, 2024 that will close this issue
@Wep-staR
Copy link

Wep-staR commented Dec 9, 2024

@kevin-montrose please approve PR or at least confirm that this serializer is out of support, so that I could have a proof reason to spend effort on replacing Jill with System.text.json.

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 a pull request may close this issue.

2 participants