diff --git a/CryptoExchange.Net/Converters/SystemTextJson/ArrayConverter.cs b/CryptoExchange.Net/Converters/SystemTextJson/ArrayConverter.cs
index 7c2b104..ad399b4 100644
--- a/CryptoExchange.Net/Converters/SystemTextJson/ArrayConverter.cs
+++ b/CryptoExchange.Net/Converters/SystemTextJson/ArrayConverter.cs
@@ -92,8 +92,11 @@ namespace CryptoExchange.Net.Converters.SystemTextJson
if (reader.TokenType == JsonTokenType.EndArray)
break;
- var attribute = attributes.SingleOrDefault(a => a.ArrayProperty.Index == index);
- var targetType = attribute.PropertyInfo.PropertyType;
+ var attribute = attributes.SingleOrDefault(a => a.ArrayProperty.Index == index);
+ if (attribute == null)
+ continue;
+
+ var targetType = attribute.PropertyInfo.PropertyType;
object? value = null;
if (attribute.JsonConverterType != null)
diff --git a/CryptoExchange.Net/Testing/SocketSubscriptionValidator.cs b/CryptoExchange.Net/Testing/SocketSubscriptionValidator.cs
index d273a65..5ce2771 100644
--- a/CryptoExchange.Net/Testing/SocketSubscriptionValidator.cs
+++ b/CryptoExchange.Net/Testing/SocketSubscriptionValidator.cs
@@ -50,6 +50,7 @@ namespace CryptoExchange.Net.Testing
/// Method name for looking up json test values
/// Use nested json property for compare
/// Ignore certain properties
+ /// Use the first item of an array update
/// Path
///
///
@@ -58,7 +59,8 @@ namespace CryptoExchange.Net.Testing
string name,
string? nestedJsonProperty = null,
List? ignoreProperties = null,
- string? addressPath = null)
+ string? addressPath = null,
+ bool? useFirstUpdateItem = null)
{
var listener = new EnumValueTraceListener();
Trace.Listeners.Add(listener);
@@ -159,9 +161,9 @@ namespace CryptoExchange.Net.Testing
throw new Exception($"{name} Update send to client did not trigger in update handler");
if (_stjCompare == true)
- SystemTextJsonComparer.CompareData(name, update, compareData, nestedJsonProperty ?? _nestedPropertyForCompare, ignoreProperties);
+ SystemTextJsonComparer.CompareData(name, update, compareData, nestedJsonProperty ?? _nestedPropertyForCompare, ignoreProperties, useFirstUpdateItem ?? false);
else
- JsonNetComparer.CompareData(name, update, compareData, nestedJsonProperty ?? _nestedPropertyForCompare, ignoreProperties);
+ JsonNetComparer.CompareData(name, update, compareData, nestedJsonProperty ?? _nestedPropertyForCompare, ignoreProperties, useFirstUpdateItem ?? false);
}
}