stride3d/stride · error · ArgumentException
doesn't meet the condition.
Error message
{paramName} doesn't meet the condition. What it means
Stride.Core.Assets.Editor.ArgumentCheck.Condition validates that a non-null variable satisfies a caller-supplied predicate; if predicate.Invoke(variable) returns false it throws ArgumentException with the message "{paramName} doesn't meet the condition." It is a general-purpose contract helper, so this error means an argument passed an API's stated condition check but failed it.
Solutions
- Read the calling API's source/contract to learn the exact predicate and validate the value before passing it.
- Check the paramName in the exception message — it names the offending argument directly.
- Pre-validate the value with the same condition and fail early with a descriptive message.
- For default-initialized values (0, empty), initialize the argument to a valid value before the call.
Example fix
// before
builder.SetCapacity(count); // count == 0 fails Condition(count, c => c > 0)
// after
if (count <= 0)
throw new ArgumentException("Capacity must be positive", nameof(count));
builder.SetCapacity(count); Defensive patterns
Strategy: validation
Validate before calling
if (value <= 0) throw new ArgumentException("must be positive", nameof(value));
apiCall(value); Try / catch
try
{
apiCall(arg);
}
catch (ArgumentException ex) when (ex.Message.Contains("doesn't meet the condition"))
{
logger.LogError(ex, "Argument {Param} violated condition", ex.ParamName);
throw;
} Prevention
- Run the same predicate locally before calling APIs guarded by ArgumentCheck.
- Never pass default-initialized values (0, empty string) into contract-checked parameters.
- Include paramName in your own diagnostics to speed triage.
When it happens
Trigger: Calling any API that guards its parameters with ArgumentCheck.Condition (directly or via ArgumentNotNullAndCondition-style helpers) and passing a value for which the required predicate returns false, e.g. a non-positive number where positivity is required, or a string failing a format predicate.
Common situations: Passing default(T) numeric values (0) into APIs requiring positive counts; passing paths/identifiers that fail pattern checks; constructing asset objects programmatically with values that the interactive editor would have validated up front; after refactors changed a predicate without updating call sites.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- A NodeIndex instance cannot be passed as the value of…
- Argument must be at least 2.
- ArgumentNullException (targetProfiles)
- ArgumentNullException: value
- array is multi-dimensional
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/a66ec81822eac25c.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.Core.Assets.Editor/ArgumentCheck.cs:60
/// </summary>
/// <typeparam name="T">The type of the <paramref name="variable"/>.</typeparam>
/// <param name="variable">The value to check.</param>
/// <param name="predicate">The predicate that implements the condition.</param>
/// <param name="variableName">The name of the variable being checked.</param>
/// <exception cref="ArgumentException">
/// <paramref name="variable"/> doesn't meet the <paramref name="predicate"/>.
/// </exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Condition<T>(T variable, Predicate<T> predicate, string variableName)
{
var paramName = variableName ?? "The variable";
// Variable and predicate cannot be null
NotNull(variable, paramName);
NotNull(predicate, "predicate");
if (!predicate.Invoke(variable))
{
throw new ArgumentException($"{paramName} doesn't meet the condition.");
}
}
/// <summary>
/// Checks wether the <paramref name="collection"/> is not empty.
/// Otherwise throws an exception.
/// </summary>
/// <param name="collection">The collection to check.</param>
/// <param name="variableName">The name of the variable being checked.</param>
/// <exception cref="ArgumentNullException">
/// The <paramref name="collection"/> cannot be <see langword="null"/>.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">
/// The <paramref name="collection"/> is empty.
/// </exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void NotEmpty(ICollection collection, string variableName)
{View on GitHub (pinned to 96fad776d2)