{"record":{"id":"1a73c34bbe4ed947","repo":"stride3d/stride","slug":"value-imagereadback","errorCode":null,"errorMessage":"value","messagePattern":"value","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/Images/ImageReadback/ImageReadback.cs","lineNumber":57,"sourceCode":"            FrameDelayCount = 16;\n            clock = new Stopwatch();\n        }\n\n        /// <summary>\n        /// Gets or sets the number of frame to store before reading back. Default is <c>16</c>.\n        /// </summary>\n        /// <value>The frame delay count.</value>\n        public int FrameDelayCount\n        {\n            get\n            {\n                return frameDelayCount;\n            }\n            set\n            {\n                if (value <= 0)\n                {\n                    throw new ArgumentOutOfRangeException(\"value\", \"Expecting a value > 0\");\n                }\n\n                frameDelayCount = value;\n            }\n        }\n\n        /// <summary>\n        /// Gets a boolean indicating whether a result is available from <see cref=\"Result\"/>.\n        /// </summary>\n        /// <value>A result available.</value>\n        public bool IsResultAvailable { get; private set; }\n\n        /// <summary>\n        /// Gets a boolean indicating whether the readback is slow and may be stalling, indicating a <see cref=\"FrameDelayCount\"/> to low or\n        /// an input texture too large for an efficient non-blocking readback.\n        /// </summary>\n        /// <value>The readback is slow and stalling.</value>\n        public bool IsSlow { get; private set; }","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/Images/ImageReadback/ImageReadback.cs#L39-L75","documentation":"The FrameDelayCount property setter on Stride's ImageReadback renderer validates that the assigned value is strictly greater than 0. A frame delay of 0 or negative is meaningless for readback pipelining (the renderer needs at least one frame of latency to schedule GPU->CPU copies), so it throws ArgumentOutOfRangeException. This is a fail-fast guard on a public property, thrown at assignment time rather than at render time.","triggerScenarios":"Setting imageReadback.FrameDelayCount = 0 (or any negative value) directly in code, or deserializing/binding a SceneCameraRenderer/editor configuration where the property is set to 0 from a script or asset property grid.","commonSituations":"Developers assuming 0 means 'no delay / read back immediately' and assigning 0; procedural setup code computing a delay value that resolves to 0; data-binding an int field initialized to 0 onto the property.","solutions":["Assign a value >= 1, e.g. frameDelayCount = 1 for minimal latency.","If you want immediate readback, do not reduce FrameDelayCount to 0; instead disable/remove the ImageReadback processor from the graphics compositor.","Clamp or validate user/config-supplied values before assignment: Math.Max(1, requestedDelay)."],"exampleFix":"// before\nimageReadback.FrameDelayCount = 0;\n// after\nimageReadback.FrameDelayCount = Math.Max(1, requestedDelay);","handlingStrategy":"validation","validationCode":"if (frameDelayCount <= 0) throw new ArgumentException(\"FrameDelayCount must be > 0\");\nimageReadback.FrameDelayCount = frameDelayCount;","typeGuard":"static bool IsValidFrameDelay(int v) => v > 0;","tryCatchPattern":"try { imageReadback.FrameDelayCount = value; }\ncatch (ArgumentOutOfRangeException) { imageReadback.FrameDelayCount = 1; }","preventionTips":["Never assign 0 to FrameDelayCount; minimum valid value is 1.","Clamp any computed/user-supplied delay with Math.Max(1, v).","Initialize the property explicitly after creating the ImageReadback processor instead of relying on field defaults."],"tags":["argument-out-of-range","rendering","stride","property-setter"],"backgroundTag":"value-out-of-range","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}