public static async Task Check(AttemptContext?ctx, string interactionPoint, JObject?fc) { if (fc == null) { return; } try { foreach (var prop in fc.Children <JProperty>()) { if (interactionPoint != prop.Name) { continue; } var checks = prop.Value.ToObject <CompatibilityCheck[]>(); foreach (var check in checks) { string?failureMessage = null; if (check.ProtocolVersion != null) { if (ProtocolVersion.SupportedVersion < check.ProtocolVersion.Value) { failureMessage = $"SupportedVersion {ProtocolVersion.SupportedVersion} is less than required {check.ProtocolVersion} @{interactionPoint}"; } } else if (check.ExtensionCheck != null) { if (!ProtocolVersion.Supported(check.ExtensionCheck)) { failureMessage = $"Extension '{check.ExtensionCheck}' is not supported @{interactionPoint}."; } } if (failureMessage != null) { if (check.Behavior == CompatibilityCheck.CheckBehaviorRetry) { if (check.RetryDelay != null) { await Task.Delay(check.RetryDelay.Value).CAF(); } var fcf = new ForwardCompatibilityFailureRequiresRetryException(failureMessage); throw ErrorBuilder.CreateError(ctx, ErrorClass.FailOther, fcf) .RetryTransaction() .Build(); } else { var fcf = new ForwardCompatibilityFailureException(failureMessage); throw ErrorBuilder.CreateError(ctx, ErrorClass.FailOther, fcf) .Build(); } } } } } catch (JsonSerializationException ex) { var fcf = new ForwardCompatibilityFailureException("Check failed", ex); throw ErrorBuilder.CreateError(ctx, ErrorClass.FailOther, fcf) .Build(); } }