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 doesn't look like this repo is actively maintained but I will post this in the hope that someone can fix this at some point.
Describe the bug
When boxed types are deserialized into a field, if that field has an existing (or default) value that is not of the same type, an exception is thrown. Please see the minimal example below. Expected: The object with the field should be deserialized correctly. Actual: An exception is thrown. See stack trace below.
How to reproduce the bug
SerializerConfig is the default one.
I have also tried 'Serialize References' with the same result.
[Fact]publicvoidShowError(){vartoSerialize=newMyClass{obj=555,// Box this integer.};// Use default config. Using serialize references also throws the same error.varserializer=newCerasSerializer();byte[]bytes=serializer.Serialize(toSerialize);vardeserialized=serializer.Deserialize<MyClass>(bytes);deserialized.Should().BeEquivalentTo(toSerialize);}publicclassMyClass{publicobject?obj="Some string";}
Result:
System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Int32'.
It doesn't look like this repo is actively maintained but I will post this in the hope that someone can fix this at some point.
Describe the bug
When boxed types are deserialized into a field, if that field has an existing (or default) value that is not of the same type, an exception is thrown. Please see the minimal example below.
Expected: The object with the field should be deserialized correctly.
Actual: An exception is thrown. See stack trace below.
How to reproduce the bug
SerializerConfig is the default one.
I have also tried 'Serialize References' with the same result.
Result:
Thrown on line 288 in ReferenceFormatter.cs:
https://github.com/rikimaru0345/Ceras/blob/de8798b368ea3983e9113be9a8db51ee6e9eda26/src/Ceras/Formatters/ReferenceFormatter.cs#L288C7-L288C7
Platform
The text was updated successfully, but these errors were encountered: