-
-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Labels
bugSomething isn't workingSomething isn't working
Description
IDictionary<,> and IReadOnlyDictionary<,> is being serialized as array type and cannot be deserialized back to Test type
(normal Dictionary works btw)
Code to Reproduce:
using System;
using System.Collections.Generic;
using Tomlet;
var test = new Test();
var toml = TomletMain.TomlStringFrom(test);
Console.WriteLine(toml);
class Test
{
IDictionary<string, string> Value { get; set; } = new Dictionary<string, string>()
{
["hello"] = "world"
};
}Output:
[[Value]]
key = "hello"
value = "world"
Key = "hello"
Value = "world"Deserializing back:
test = TomletMain.To<Test>(toml);Output:
Unhandled exception. System.ArgumentException: Object of type 'System.String[]' cannot be converted to type 'System.Collections.Generic.IDictionary`2[System.String,System.String]'.
at System.RuntimeType.CheckValue(Object& value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
at Tomlet.TomlCompositeDeserializer.<>c__DisplayClass0_2.<For>b__7(TomlValue value) in /_/Tomlet/TomlCompositeDeserializer.cs:line 116
at Tomlet.TomletMain.To(Type what, TomlValue value, TomlSerializerOptions options) in /_/Tomlet/TomletMain.cs:line 65
at Tomlet.TomletMain.To(Type what, String tomlString, TomlSerializerOptions options) in /_/Tomlet/TomletMain.cs:line 41
at Tomlet.TomletMain.To[T](String tomlString, TomlSerializerOptions options) in /_/Tomlet/TomletMain.cs:line 26
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working