{"record":{"id":"1ccbfbf0191d7a0e","repo":"stride3d/stride","slug":"invalid-null-mixin-name","errorCode":null,"errorMessage":"Invalid null mixin name","messagePattern":"Invalid null mixin name","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Effects/ShaderMixinContext.cs","lineNumber":199,"sourceCode":"            {\n                var mixin = mixinParent.Mixins[i];\n                if (mixin.ClassName == name)\n                {\n                    mixinParent.Mixins.RemoveAt(i);\n                }\n            }\n        }\n\n        /// <summary>\n        /// Mixins a <see cref=\"ShaderMixinSource\" /> into the specified mixin tree.\n        /// </summary>\n        /// <param name=\"mixinTree\">The mixin tree.</param>\n        /// <param name=\"name\">The name.</param>\n        public void Mixin(ShaderMixinSource mixinTree, string name)\n        {\n            if (name == null)\n            {\n                throw new ArgumentNullException(\"name\", \"Invalid null mixin name\");\n            }\n\n            IShaderMixinBuilder builder;\n            if (!registeredBuilders.TryGetValue(name, out builder))\n            {\n                // Else simply add the name of the shader\n                mixinTree.Mixins.Add(new ShaderClassSource(name));\n            }\n            else if (builder != null)\n            {\n                builder.Generate(mixinTree, this);\n            }\n        }\n\n        /// <summary>\n        /// Mixins a <see cref=\"ShaderClassSource\" /> identified by its name/generic parameters into the specified mixin tree.\n        /// </summary>\n        /// <param name=\"mixinTree\">The mixin tree.</param>","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Effects/ShaderMixinContext.cs#L181-L217","documentation":"ShaderMixinContext.Mixin throws ArgumentNullException(\"name\", \"Invalid null mixin name\") when the shader name passed to Mixin is null. The name is used to look up a registered IShaderMixinBuilder or to add a ShaderClassSource. The custom message clarifies the mixin name specifically was null.","triggerScenarios":"Calling ctx.Mixin(mixinTree, null), e.g. when the mixin name comes from ShaderMixinGeneratorSource.Name or a composition entry that was not initialized.","commonSituations":"A composition slot with no assigned shader; deserialized effect definitions with missing shader names; ShaderClassSource names typed incorrectly leading to null resolution upstream.","solutions":["Pass a valid shader class name string to Mixin","Check the composition/source object whose Name is null and fix its initialization","Validate effect/composition definitions before invoking the mixin pipeline"],"exampleFix":"// before\ncontext.Mixin(tree, composition.ShaderName); // may be null\n// after\nif (!string.IsNullOrEmpty(composition.ShaderName))\n    context.Mixin(tree, composition.ShaderName);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(name)) throw new InvalidOperationException(\"Composition has no shader assigned\");\ncontext.Mixin(tree, name);","typeGuard":"static bool HasMixinName(string name) => !string.IsNullOrEmpty(name);","tryCatchPattern":"try { context.Mixin(tree, name); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"name\") { throw new InvalidOperationException(\"Composition slot has no shader assigned\", ex); }","preventionTips":["Verify all composition slots have a shader assigned before compilation","Validate deserialized effect definitions","Check upstream sources of Name for null returns"],"tags":["csharp","null-argument","mixin","shaders"],"backgroundTag":"null-argument","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"}