-
Notifications
You must be signed in to change notification settings - Fork 33
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
Use invariant culture for (de)serialization #298
Use invariant culture for (de)serialization #298
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great work! I left a couple of questions for you.
The tests should run fine for both netfx462 and net8
No, it was probably the auto-suggestion from vscode at the time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MartinM85 We'll also need a changelog entry/version bump here as well. Otherwise looks good to me.
Still one opened question: |
I think the challenge here is there is no agreed upon and standardized way to represent by arrays for the form of mediatype. |
This probably says it all....
|
I was asking because FormSerializationWriter.WriteAnyValue writes IEnumerable, but not an array |
I believe arrays implement
One thing to note is that
What we could probably do is add a case for the
|
array implements IEnumerable, but |
Yes it was probably a matter of the type assertion engine not matching in this case and just adding a new one so it explicitly matches. |
tests/serialization/json/Converters/JsonDateTimeOffsetConverter.cs
Outdated
Show resolved
Hide resolved
tests/serialization/json/Converters/JsonDateTimeOffsetConverter.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the great work here!
@andrueastman for final review, merge and publish
fixes #280
fixes #283
Unit tests discovered several issues:
FormSerializationWriter.WriteAnyValue
writes array as stringTest
WriteAdditionalData_AreWrittenCorrectly()
{ "prop12", new byte[] { 2, 4, 6 } }
is serialized asprop12=System.Byte%5B%5D
Time
class has two constructorsTextParseNode.GetTimeValue
parsesDateTime
value from string and callsTime(DateTime)
ctor. In this case theDate
property ofDateTime
contains current date.If you create a new instance of
Time
by callingTime(int hour, int minute, int second)
ctor as part of unit test, thenDate
property has year, month and day set to 1.When a unit test is created,
Assert.Equal
will fail, because it compares alsoDateTime
properties, which can be different.I would suggest to get rid of
DateTime
property andTime(DateTime)
fromTime
. Seems to me better than overridden Equals method.Issue
JsonSerializer.Serialize
insideJsonSerializationWriter.WriteFloatValue
andJsonSerializationWriter.WriteDoubleValue
serialize for .net462. Unit tests failDouble
Float
I think that net462 is used in tests projects, because xunit runner doesn't support .netstandard2.x
GetEnumValue
andGetCollectionOfEnumValues
defined explicitly inFormParseNode
?