YamlDotNet icon indicating copy to clipboard operation
YamlDotNet copied to clipboard

[Question] Serialization result of `DBNull.Value` should be empty object(`{}`)?

Open filzrev opened this issue 11 months ago • 0 comments
trafficstars

Currently, DBNull.Value is serialized to empty object string({}).

There is dedicated code path for DBNull.Value on FullObjectGraphTraversalStrategy. But it seems not be used. (Because value.IsDbNull() always returns false, And ther is no break statement)

https://github.com/aaubry/YamlDotNet/blob/7bed5cf0750c7ca58ba69ad8c07f6eb136080540/YamlDotNet/Serialization/ObjectGraphTraversalStrategies/FullObjectGraphTraversalStrategy.cs#L141-L144

Is this current behavior is working as expected?

[!NOTE] Returning empty object is same behavior as System.Text,Json. (https://github.com/dotnet/runtime/issues/418)

filzrev avatar Dec 01 '24 05:12 filzrev