From d3457952e5f06e99a3f4b0cc080966efdba22c7e Mon Sep 17 00:00:00 2001 From: JKorf Date: Tue, 7 Aug 2018 08:33:37 +0200 Subject: [PATCH] Added check for dictionary in object validation --- CryptoExchange.Net/ExchangeClient.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CryptoExchange.Net/ExchangeClient.cs b/CryptoExchange.Net/ExchangeClient.cs index 6bf89cd..0beb398 100644 --- a/CryptoExchange.Net/ExchangeClient.cs +++ b/CryptoExchange.Net/ExchangeClient.cs @@ -209,14 +209,16 @@ namespace CryptoExchange.Net if (checkObject && log.Level == LogVerbosity.Debug) { try - { + { if (obj is JObject o) + { CheckObject(typeof(T), o); + } else { var ary = (JArray)obj; if (ary.HasValues && ary[0] is JObject jObject) - CheckObject(typeof(T).GetElementType(), jObject); + CheckObject(typeof(T).GetElementType(), jObject); } } catch (Exception e) @@ -253,6 +255,9 @@ namespace CryptoExchange.Net // If type has a custom JsonConverter we assume this will handle property mapping return; + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<,>)) + return; + bool isDif = false; var properties = new List(); var props = type.GetProperties();