1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-08-28 19:21:32 +00:00

Added check for dictionary in object validation

This commit is contained in:
JKorf 2018-08-07 08:33:37 +02:00
parent 45fdfbc062
commit d3457952e5

View File

@ -209,14 +209,16 @@ namespace CryptoExchange.Net
if (checkObject && log.Level == LogVerbosity.Debug) if (checkObject && log.Level == LogVerbosity.Debug)
{ {
try try
{ {
if (obj is JObject o) if (obj is JObject o)
{
CheckObject(typeof(T), o); CheckObject(typeof(T), o);
}
else else
{ {
var ary = (JArray)obj; var ary = (JArray)obj;
if (ary.HasValues && ary[0] is JObject jObject) if (ary.HasValues && ary[0] is JObject jObject)
CheckObject(typeof(T).GetElementType(), jObject); CheckObject(typeof(T).GetElementType(), jObject);
} }
} }
catch (Exception e) catch (Exception e)
@ -253,6 +255,9 @@ namespace CryptoExchange.Net
// If type has a custom JsonConverter we assume this will handle property mapping // If type has a custom JsonConverter we assume this will handle property mapping
return; return;
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<,>))
return;
bool isDif = false; bool isDif = false;
var properties = new List<string>(); var properties = new List<string>();
var props = type.GetProperties(); var props = type.GetProperties();