{"record":{"id":"fd3b7747b6adffa0","repo":"stride3d/stride","slug":"item","errorCode":null,"errorMessage":"item","messagePattern":"item","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/GraphicsRendererCollectionBase.cs","lineNumber":69,"sourceCode":"        {\n            return currentRenderers.GetEnumerator();\n        }\n\n        IEnumerator<T> IEnumerable<T>.GetEnumerator()\n        {\n            return currentRenderers.GetEnumerator();\n        }\n\n        IEnumerator IEnumerable.GetEnumerator()\n        {\n            return ((IEnumerable)currentRenderers).GetEnumerator();\n        }\n\n        public void Add(T item)\n        {\n            if (item == null)\n            {\n                throw new ArgumentNullException(\"item\");\n            }\n            currentRenderers.Add(item);\n        }\n\n        public void Clear()\n        {\n            currentRenderers.Clear();\n        }\n\n        public bool Contains(T item)\n        {\n            return currentRenderers.Contains(item);\n        }\n\n        public void CopyTo(T[] array, int arrayIndex)\n        {\n            currentRenderers.CopyTo(array, arrayIndex);\n        }","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/GraphicsRendererCollectionBase.cs#L51-L87","documentation":"Argument-null validation in GraphicsRendererCollectionBase.Add: the item (a T renderer) is null. The collection tracks active renderers and later iterates them every frame; a null entry would break enumeration and rendering, so Add rejects it with ArgumentNullException named 'item'.","triggerScenarios":"Calling Add(null) on a GraphicsRendererCollection (e.g. RenderStage effects/renderers list).","commonSituations":"A factory method returning null renderer (failed creation) that is then added unconditionally; optional renderer resolved from a service that is absent.","solutions":["Check the renderer for null before adding.","Ensure the renderer was constructed successfully.","Throw/log upstream instead of adding a null entry."],"exampleFix":"// before\nrenderers.Add(CreateRenderer()); // may be null\n// after\nvar r = CreateRenderer();\nif (r != null) renderers.Add(r);","handlingStrategy":"type-guard","validationCode":"if (renderer == null) { log.Warn(\"Skipping null renderer\"); return; }\nrenderers.Add(renderer);","typeGuard":"bool IsValid<T>(T item) where T : class => item != null;","tryCatchPattern":"try { renderers.Add(item); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"item\")\n{\n    log.Warn(\"Tried to add a null renderer to the collection\");\n}","preventionTips":["Null-check results of renderer factories before Add.","Avoid optional-injection services returning null silently."],"tags":["stride","null-argument","collection"],"backgroundTag":"null-argument","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"}