stride3d/stride · error · ArgumentException
Invalid Operator argument in ComputeBinaryCurve
Error message
Invalid Operator argument in ComputeBinaryCurve
What it means
ComputeBinaryCurve.Evaluate blends two curve values using a BinaryCurveOperator switch (Add, Subtract, Multiply are handled). If the Operator property holds any other value (undefined enum member or an operator added later without support), the switch falls through and this ArgumentException is thrown.
Solutions
- Set the curve's Operator to a supported value: Add, Subtract, or Multiply.
- Reimport/re-save the animation asset whose operator value is invalid.
- Validate/cast enum values with Enum.IsDefined before assigning Operator.
- If you added a new BinaryCurveOperator member, add the corresponding case (and Add/Divide methods) in ComputeBinaryCurve.
Example fix
// before curve.Operator = (BinaryCurveOperator)7; // invalid // after var op = (BinaryCurveOperator)7; curve.Operator = Enum.IsDefined(typeof(BinaryCurveOperator), op) ? op : BinaryCurveOperator.Add;
Defensive patterns
Strategy: validation
Validate before calling
// Ensure the operator is supported before evaluation
if (curve.Operator != BinaryCurveOperator.Add &&
curve.Operator != BinaryCurveOperator.Subtract &&
curve.Operator != BinaryCurveOperator.Multiply)
curve.Operator = BinaryCurveOperator.Add; Type guard
bool IsSupportedOperator(BinaryCurveOperator op) =>
op == BinaryCurveOperator.Add || op == BinaryCurveOperator.Subtract || op == BinaryCurveOperator.Multiply; Try / catch
try { value = curve.Evaluate(time); }
catch (ArgumentException ex) when (ex.Message.Contains("ComputeBinaryCurve")) { /* fix Operator on the curve asset */ } Prevention
- Assign Operator only with named enum members, never raw casts
- Reimport animation assets that fail evaluation
- Keep ComputeBinaryCurve's switch in sync with the enum
When it happens
Trigger: Evaluating a BinaryComputeCurve whose Operator enum value is not one of Add/Subtract/Multiply — e.g. a corrupted asset, a hand-set enum cast, or evaluating during animation update at ComputeBinaryCurve.cs:70.
Common situations: Animation assets authored with an unsupported operator; enum value corrupted in serialized data; runtime code casting an int to BinaryCurveOperator without validation; Stride version mismatch introducing new operators.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- blendOperation
- Animation 1 is not set
- Animation 2 is not set
- ArgumentOutOfRangeException: orientation
- ArgumentOutOfRangeException
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/58457f6dcabaa620.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Engine/Animations/ComputeBinaryCurve.cs:70
/// <inheritdoc/>
public T Evaluate(float location)
{
var lValue = LeftChild?.Evaluate(location) ?? new T();
var rValue = RightChild?.Evaluate(location) ?? new T();
switch (Operator)
{
case BinaryCurveOperator.Add:
return Add(lValue, rValue);
case BinaryCurveOperator.Subtract:
return Subtract(lValue, rValue);
case BinaryCurveOperator.Multiply:
return Multiply(lValue, rValue);
}
throw new ArgumentException("Invalid Operator argument in ComputeBinaryCurve");
}
/// <summary>
/// The operation used to blend the two values
/// </summary>
/// <userdoc>
/// The operation used to blend the two values
/// </userdoc>
[DataMember(10)]
[InlineProperty]
public BinaryCurveOperator Operator
{
get { return operatorMethod; }
set
{
operatorMethod = value;
hasChanged = true;
}View on GitHub (pinned to 96fad776d2)