SamboyCoding/Tomlet

Tomlet.TomletMain.TomlStringFrom<T> throwing exceptions in version 5.2+

jrx00e opened this issue · 2 comments

Using object serialization to toml via Tomlet.TomletMain.TomlStringFrom an exception is being thrown in 5.2+ that didn't occur before.

The object hierarchy has a few layers of nesting.
The change in behavior likely from this PR

Exception:

The string |'"items.item_details".item_schedule'.hours| (between the two bars) contains at least one of both a double quote and a single quote, so it cannot be used for a TOML key.

here is code samples

  1. dotnetfiddle with serialization working in 5.1.2: https://dotnetfiddle.net/8qkxkT
  2. dotnetfiddle with exception for same in 5.3 https://dotnetfiddle.net/4xqirr

Expected serialized to toml output :

`model_name = "M1"

[[items]]
item_name = "item1"
[items.item_details]
detail_group_name = "item1details"

[[items.item_details.item_schedule]]
schedule_day = "Mon"

[[items.item_details.item_schedule.hours]]
[[items.item_details.item_schedule.hours.shifts]]
shift_name = "morningA"

[[items.item_details.item_schedule.hours.shifts]]
shift_name = "afternoonA"

[[items.item_details.item_schedule.hours.holidays]]
holiday_name = "none"`

Ooh that is certainly a nasty bug, I'll try to take a look, might be this weekend

Sorry for the delay, this should be fixed in 5.3.1