{"record":{"id":"58457f6dcabaa620","repo":"stride3d/stride","slug":"invalid-operator-argument-in-computebinarycurve","errorCode":null,"errorMessage":"Invalid Operator argument in ComputeBinaryCurve","messagePattern":"Invalid Operator argument in ComputeBinaryCurve","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Engine/Animations/ComputeBinaryCurve.cs","lineNumber":70,"sourceCode":"        /// <inheritdoc/>\n        public T Evaluate(float location)\n        {\n            var lValue = LeftChild?.Evaluate(location) ?? new T();\n            var rValue = RightChild?.Evaluate(location) ?? new T();\n\n            switch (Operator)\n            {\n                case BinaryCurveOperator.Add:\n                    return Add(lValue, rValue);\n\n                case BinaryCurveOperator.Subtract:\n                    return Subtract(lValue, rValue);\n\n                case BinaryCurveOperator.Multiply:\n                    return Multiply(lValue, rValue);\n            }\n\n            throw new ArgumentException(\"Invalid Operator argument in ComputeBinaryCurve\");\n        }\n\n        /// <summary>\n        /// The operation used to blend the two values\n        /// </summary>\n        /// <userdoc>\n        /// The operation used to blend the two values\n        /// </userdoc>\n        [DataMember(10)]\n        [InlineProperty]\n        public BinaryCurveOperator Operator\n        {\n            get { return operatorMethod; }\n            set\n            {\n                operatorMethod = value;\n                hasChanged = true;\n            }","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Engine/Animations/ComputeBinaryCurve.cs#L52-L88","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\ncurve.Operator = (BinaryCurveOperator)7; // invalid\n\n// after\nvar op = (BinaryCurveOperator)7;\ncurve.Operator = Enum.IsDefined(typeof(BinaryCurveOperator), op) ? op : BinaryCurveOperator.Add;","handlingStrategy":"validation","validationCode":"// Ensure the operator is supported before evaluation\nif (curve.Operator != BinaryCurveOperator.Add &&\n    curve.Operator != BinaryCurveOperator.Subtract &&\n    curve.Operator != BinaryCurveOperator.Multiply)\n    curve.Operator = BinaryCurveOperator.Add;","typeGuard":"bool IsSupportedOperator(BinaryCurveOperator op) =>\n    op == BinaryCurveOperator.Add || op == BinaryCurveOperator.Subtract || op == BinaryCurveOperator.Multiply;","tryCatchPattern":"try { value = curve.Evaluate(time); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"ComputeBinaryCurve\")) { /* fix Operator on the curve asset */ }","preventionTips":["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"],"tags":["animation","enum","invalid-argument","curves"],"backgroundTag":"invalid-enum-value","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}