hadashiA/VYaml

Fails to Properly Deserialize `null` Strings

Freeesia opened this issue · 2 comments

An exception is thrown when using VYaml to serialize and then deserialize a record object containing a null string. The following code reproduces this issue:

var obj = new StringTest(null);
var yaml = YamlSerializer.Serialize(obj);
var obj2 = YamlSerializer.Deserialize<StringTest>(yaml);

if (obj.Name != obj2.Name)
{
    throw new Exception("Failed");
}

[YamlObject]
partial record StringTest(string? Name);

The expected outcome of this code is that obj.Name and obj2.Name should be equal. However, they are not, hence the exception.
Could you please look into this issue and provide guidance or a potential fix? Thank you.

Oh. Sorry. I thought I fixed this issue in #44, but there was an omission. I only had the Unity side of the source committed by mistake.

Fixed in #47

Thank you for the fix. I am looking forward to the release.