You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems to be a slight bug when deserializing a string to DateOnly on net6.
Reproduce
It looks like the test suite only runs on net8, not net6. Run it with target framework net6 to reproduce.
Locally it just failed when debugging the exact test. When running through the Test Explorer, it seems like the flag NET6_0_OR_GREATER was not set.
Fix
The code use reflection to find the Parse-method, but the current code only works for net8. The overload with only string and IFormatProvider was introduced in net8. Parse on net6 has 3 parameters.
// Include DateTimeStyle to work with both net 6 and net 8:varparseDateOnly=typeof(DateOnly).GetMethod(nameof(DateOnly.Parse),new[]{ value.Type,typeof(IFormatProvider),typeof(DateTimeStyles)});// <-- Last parametervalue= Expression.ConvertChecked(
Expression.Call(null,
parseDateOnly,
value,
Expression.Constant(CultureInfo.InvariantCulture),
Expression.Constant(DateTimeStyles.RoundtripKind)),//<-- with DateTimeStyle
target);
The same goes for TimeOnly just below in the same file.
I'm sorry for not providing a PR with a fix right away - might be back for it soon :)
If net6 is out-of-support for this library, then please close this issue :)
The text was updated successfully, but these errors were encountered:
It seems to be a slight bug when deserializing a string to DateOnly on net6.
Reproduce
It looks like the test suite only runs on net8, not net6. Run it with target framework net6 to reproduce.
Locally it just failed when debugging the exact test. When running through the Test Explorer, it seems like the flag
NET6_0_OR_GREATER
was not set.Fix
The code use reflection to find the Parse-method, but the current code only works for net8. The overload with only string and IFormatProvider was introduced in net8.
Parse
on net6 has 3 parameters.dotnet-avro/src/Chr.Avro/Serialization/StringDeserializerBuilderCase.cs
Line 54 in e1d7129
The same goes for
TimeOnly
just below in the same file.I'm sorry for not providing a PR with a fix right away - might be back for it soon :)
If net6 is out-of-support for this library, then please close this issue :)
The text was updated successfully, but these errors were encountered: