{"record":{"id":"3bfe1e1bb3e1e59c","repo":"AvaloniaUI/Avalonia","slug":"this-cue-object-s-value-should-be-within-or-equal","errorCode":null,"errorMessage":"This cue object's value should be within or equal to 0.0 and 1.0","messagePattern":"This cue object's value should be within or equal to 0\\.0 and 1\\.0","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/Animation/Cue.cs","lineNumber":27,"sourceCode":"    /// </summary>\n    [TypeConverter(typeof(CueTypeConverter))]\n    public readonly record struct Cue : IEquatable<Cue>, IEquatable<double>\n    {\n        /// <summary>\n        /// The normalized percent value, ranging from 0.0 to 1.0\n        /// </summary>\n        public double CueValue { get; }\n\n        /// <summary>\n        /// Sets a new <see cref=\"Cue\"/> object.\n        /// </summary>\n        /// <param name=\"value\"></param>\n        public Cue(double value)\n        {\n            if (value <= 1 && value >= 0)\n                CueValue = value;\n            else\n                throw new ArgumentException($\"This cue object's value should be within or equal to 0.0 and 1.0\");\n        }\n\n        /// <summary>\n        /// Parses a string to a <see cref=\"Cue\"/> object.\n        /// </summary>\n        public static Cue Parse(string value, CultureInfo? culture)\n        {\n            string v = value;\n\n            if (value.EndsWith('%'))\n            {\n                v = v.TrimEnd('%');\n            }\n\n            if (double.TryParse(v, NumberStyles.Float, culture, out double res))\n            {\n                return new Cue(res / 100d);\n            }","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Animation/Cue.cs#L9-L45","documentation":"Thrown by the Cue constructor when the supplied double is outside the inclusive range [0.0, 1.0]. A Cue represents a normalized position within an animation timeline, so values below 0 or above 1 are meaningless and rejected.","triggerScenarios":"Constructing new Cue(value) with value < 0.0 or value > 1.0.","commonSituations":"Passing a percentage (e.g. 50) instead of a fraction (0.5); computing a cue from a ratio that can exceed 1; off-by-one in derived cue math.","solutions":["Clamp the value to [0.0, 1.0] before constructing the Cue.","Divide percentage values by 100 before passing them in.","Use Cue.Parse for percentage strings, which handles the /100 scaling."],"exampleFix":"// before\nvar cue = new Cue(50); // meant 50%\n\n// after\nvar cue = new Cue(0.5);\n// or\nvar cue = Cue.Parse(\"50%\", CultureInfo.InvariantCulture);","handlingStrategy":"validation","validationCode":"double v = Math.Clamp(raw, 0d, 1d);\nvar cue = new Cue(v);","typeGuard":"static bool IsValidCueValue(double v) => v >= 0d && v <= 1d;","tryCatchPattern":null,"preventionTips":["Treat Cue values as fractions in [0,1]; divide percentages by 100.","Clamp computed ratios before constructing a Cue.","Prefer Cue.Parse for percentage strings."],"tags":["animation","validation","range","cue","avalonia"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}