{"record":{"id":"e0f0789761cb6d85","repo":"stride3d/stride","slug":"index-imageeffect","errorCode":null,"errorMessage":"index","messagePattern":"index","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/Images/ImageEffect.cs","lineNumber":336,"sourceCode":"        public int InputCount\n        {\n            get\n            {\n                return maxInputTextureIndex + 1;\n            }\n        }\n\n        /// <summary>\n        /// Gets an input texture by the specified index.\n        /// </summary>\n        /// <param name=\"index\">The index.</param>\n        /// <returns>Texture.</returns>\n        /// <exception cref=\"System.ArgumentOutOfRangeException\">index</exception>\n        public Texture GetInput(int index)\n        {\n            if (index < 0 || index > maxInputTextureIndex)\n            {\n                throw new ArgumentOutOfRangeException(\"index\", string.Format(\"Invald texture input index [{0}]. Max value is [{1}]\", index, maxInputTextureIndex));\n            }\n            return inputTextures[index];\n        }\n\n        /// <summary>\n        /// Gets a non-null input texture by the specified index.\n        /// </summary>\n        /// <param name=\"index\">The index.</param>\n        /// <returns>Texture.</returns>\n        /// <exception cref=\"System.InvalidOperationException\"></exception>\n        protected Texture GetSafeInput(int index)\n        {\n            var input = GetInput(index);\n            if (input == null)\n            {\n                throw new InvalidOperationException(string.Format(\"Expecting texture input on slot [{0}]\", index));\n            }\n","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/Images/ImageEffect.cs#L318-L354","documentation":"GetInput retrieves an input texture by slot index and throws ArgumentOutOfRangeException(\"index\") when the index is negative or greater than maxInputTextureIndex (size of the input texture array minus 1, based on TexturingKeys.DefaultTextures.Count). The message reports both the invalid index and the maximum allowed value.","triggerScenarios":"Calling effect.GetInput(i) with i < 0, or with i >= maxInputTextureIndex (e.g. GetInput(8) when the effect supports only 4 inputs); also triggered inside GetSafeInput when given an out-of-range slot.","commonSituations":"Hard-coding slot indices that don't match the shader's declared input count; iterating with a wrong loop bound; using indices from another effect with a different input count.","solutions":["Clamp/validate the index against maxInputTextureIndex before calling","Derive slot indices from TexturingKeys.DefaultTextures.Count rather than hard-coding","Use foreach/for bounded by the effect's input count"],"exampleFix":"// before\nvar tex = effect.GetInput(8);\n// after\nif (index >= 0 && index <= effect.MaxInputTextureIndex)\n    var tex = effect.GetInput(index);","handlingStrategy":"validation","validationCode":"if (index < 0 || index > effect.MaxInputTextureIndex) return null;","typeGuard":null,"tryCatchPattern":"try { var tex = effect.GetInput(index); } catch (ArgumentOutOfRangeException) { /* log invalid slot */ }","preventionTips":["Bound loops by the effect's declared input count","Avoid hard-coded slot numbers; use named constants matching shader inputs","Prefer GetSafeInput only when the slot is known to be configured"],"tags":["argument-out-of-range","index","rendering"],"backgroundTag":"argument-out-of-range","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"}