I was trying to dump a NewtonSoft Json object, when I ran into the following error:
Unable to cast object of type 'd__64' to type 'System.Collections.IEnumerable'.
[Failed to Render Newtonsoft.Json.Linq.JObject - {
"key1": "value1",
"key2": "value2"
}]. Unable to cast object of type '<GetEnumerator>d__64' to type 'System.Collections.IEnumerable'.
[Failed to Render System.Text.Json.Nodes.JsonObject - {
"key1": "value1",
"key2": "value2"
}]. Unable to cast object of type '<GetEnumerator>d__18[System.Text.Json.Nodes.JsonNode]' to type 'System.Collections.IEnumerable'.
I have created a fix for this which I will create a pullrequest for in a bit.
To get NewtonSofts output to look nice, it is possible to add a CustomRenderer like this, which will format the output nicely:
DumpConfig.Default.AddCustomTypeHandler(typeof(JValue), (obj, _, _, _) => obj.ToString());
JObject
โโโโโโโโโโฌโโโโโโโโโโโ
โ Key โ Value โ
โโโโโโโโโโผโโโโโโโโโโโค
โ "key1" โ "value1" โ
โ "key2" โ "value2" โ
โโโโโโโโโโดโโโโโโโโโโโ