hadashiA / VYaml

The extra fast, low memory footprint YAML library for C#, focued on .NET and Unity.
MIT License
295 stars 16 forks source link

YamlSerializerOptions is not updated after the first usage #77

Closed threeplus closed 5 months ago

threeplus commented 5 months ago

It makes custom Formatters is not working all the time. It only works when I input all custom Formatters in YamlSerializerOptions at the first usage of Serialize or Deserialize. Resolver in the YamlSerializerOptions will not change after that.

When using YamlSerializer, deserializationContext and serializationContext will not be updated by YamlSerializerOptions. deserializationContext and serializationContext are static and the Resolver inside is never updated after the first creation.

The bug is related to the some code like the following in YamlSerializer.cs . var contextLocal = deserializationContext ??= new YamlDeserializationContext(options);

Your work is great. And it will be perfect if the bug is fixed.

hadashiA commented 5 months ago

Oh, thanks for the report. FIxed in #79 .