{"record":{"id":"6127469b9d718d26","repo":"stride3d/stride","slug":"vector-component-w-is-invalid-only-x-y-and-z-are-supported-612746","errorCode":null,"errorMessage":"Vector component 'W' is invalid, only 'X', 'Y' and 'Z' are supported.","messagePattern":"Vector component 'W' is invalid, only 'X', 'Y' and 'Z' are supported\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/editor/Stride.Assets.Presentation/CurveEditor/ViewModels/VectorComponentCurveViewModel.cs","lineNumber":132,"sourceCode":"                    value.Y = realPoint.Y;\n                    break;\n\n                default:\n                    throw new NotSupportedException(); // This should never happen\n            }\n        }\n    }\n\n\n    /// <summary>\n    /// Represents the curve of one component of a <see cref=\"Vector3\"/>.\n    /// </summary>\n    public sealed class Vector3ComponentCurveViewModel : VectorComponentCurveViewModel<Vector3, Vector3ComponentControlPointViewModel>\n    {\n        public Vector3ComponentCurveViewModel([NotNull] CurveEditorViewModel editor, CurveViewModelBase parent, [NotNull] ComputeAnimationCurve<Vector3> computeCurve, VectorComponent component)\n            : base(editor, parent, computeCurve, component)\n        {\n            if (component == VectorComponent.W) throw new ArgumentException(\"Vector component 'W' is invalid, only 'X', 'Y' and 'Z' are supported.\", nameof(component));\n        }\n        \n        /// <inheritdoc/>\n        protected override void UpdateComponent(ref Vector3 value, Vector2 realPoint)\n        {\n            // Update the component that is handled by this curve\n            switch (Component)\n            {\n                case VectorComponent.X:\n                    value.X = realPoint.Y;\n                    break;\n\n                case VectorComponent.Y:\n                    value.Y = realPoint.Y;\n                    break;\n\n                case VectorComponent.Z:\n                    value.Z = realPoint.Y;","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/editor/Stride.Assets.Presentation/CurveEditor/ViewModels/VectorComponentCurveViewModel.cs#L114-L150","documentation":"Vector3ComponentCurveViewModel edits one component of a Vector3 compute animation curve. Its constructor throws ArgumentException when given VectorComponent.W, since Vector3 has only X, Y and Z channels.","triggerScenarios":"Constructing new Vector3ComponentCurveViewModel(editor, parent, computeCurve, VectorComponent.W), e.g. from a generic factory iterating all four components for any vector curve.","commonSituations":"Shared X..W component loops designed for Vector4; asset metadata listing a W channel while the curve is Vector3; templates enumerating all components.","solutions":["Pass only X, Y or Z to this constructor","Make the factory enumerate three components for Vector3 curves","Drop W entries from component lists when the curve type changes","Catch ArgumentException and skip unsupported components"],"exampleFix":"// before\nnew Vector3ComponentCurveViewModel(editor, parent, curve3D, VectorComponent.W);\n// after\nnew Vector3ComponentCurveViewModel(editor, parent, curve3D, VectorComponent.Z);","handlingStrategy":"validation","validationCode":"if (component == VectorComponent.W) return null; // invalid for Vector3\nvar curveVm = new Vector3ComponentCurveViewModel(editor, parent, curve, component);","typeGuard":"bool IsValidVector3Component(VectorComponent c) => c is VectorComponent.X or VectorComponent.Y or VectorComponent.Z;","tryCatchPattern":"try { vm = new Vector3ComponentCurveViewModel(editor, parent, curve, component); }\ncatch (ArgumentException) { vm = null; }","preventionTips":["Enumerate three components for Vector3 curve factories","Strip W channels when converting Vector4 curves to Vector3","Add boundary tests for component curve construction"],"tags":["argument-exception","curve-editor","vector3"],"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"}