To following works as expected with .ToJsv() and FromJsv() but is failing with ToCsv() and .FromCsv().
Do the Csv extensions support dictionnaries?
var dictionary = new Dictionary<string, string>();
dictionary.Add("mywebhook1", "https://thewebhook.com/services/mywebhook1");
dictionary.Add("mywebhook2", "https://thewebhook.com/services/mywebhook2");
var filePath = Directory.GetCurrentDirectory() + $"{Path.DirectorySeparatorChar}webhooks.jsv";
File.WriteAllText(filePath, dictionary.ToJsv());
var dict = File.ReadAllText(filePath).FromJsv<Dictionary<string, string>>();
But this gives me an exception:
var dictionary = new Dictionary<string, string>();
dictionary.Add("mywebhook1", "https://thewebhook.com/services/mywebhook1");
dictionary.Add("mywebhook2", "https://thewebhook.com/services/mywebhook2");
var filePath = Directory.GetCurrentDirectory() + $"{Path.DirectorySeparatorChar}webhooks.csv";
File.WriteAllText(filePath, dictionary.ToCsv());
var dict = File.ReadAllText(filePath).FromCsv<Dictionary<string, string>>();
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at ServiceStack.Text.Jsv.JsvTypeSerializer.EatMapKey(ReadOnlySpan1 value, Int32& i) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Jsv\JsvTypeSerializer.cs:line 346 at ServiceStack.Text.Common.DeserializeKeyValuePair
1.ParseKeyValuePair[TKey,TValue](ReadOnlySpan1 value, Type createMapType, ParseStringSpanDelegate parseKeyFn, ParseStringSpanDelegate parseValueFn) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\DeserializeKeyValuePair.cs:line 69 at ServiceStack.Text.Common.DeserializeKeyValuePair
1.ParseKeyValuePairType(ReadOnlySpan1 value, Type createMapType, Type[] argTypes, ParseStringSpanDelegate keyParseFn, ParseStringSpanDelegate valueParseFn) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\DeserializeKeyValuePair.cs:line 132 at ServiceStack.Text.Common.DeserializeKeyValuePair
1.<>c__DisplayClass4_0.b__0(ReadOnlySpan1 value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\DeserializeKeyValuePair.cs:line 45 at ServiceStack.Text.Jsv.JsvReader
1.Parse(ReadOnlySpan1 value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Jsv\JsvReader.Generic.cs:line 102 at ServiceStack.Text.Jsv.JsvReader
1.Parse(String value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Jsv\JsvReader.Generic.cs:line 81
at ServiceStack.Text.TypeSerializer.DeserializeFromString[T](String value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\TypeSerializer.cs:line 69
at ServiceStack.Text.CsvReader1.GetSingleRow(IEnumerable
1 rows, Type recordType) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\CsvReader.cs:line 266
at ServiceStack.Text.CsvReader1.Read(List
1 rows) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\CsvReader.cs:line 365
at ServiceStack.Text.CsvReader1.ReadObject(String csv) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\CsvReader.cs:line 303 at ServiceStack.Text.CsvSerializer
1.ReadEnumerableType(String value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\CsvSerializer.cs:line 527
at ServiceStack.Text.CsvSerializer`1.ReadObject(String value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\CsvSerializer.cs:line 563
at ServiceStack.Text.CsvSerializer.DeserializeFromString[T](String text) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\CsvSerializer.cs:line 157
at ServiceStack.StringExtensions.FromCsv[T](String csv) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\StringExtensions.cs:line 568