{"record":{"id":"2e9232974d3d0056","repo":"stride3d/stride","slug":"sdfxeffectname","errorCode":null,"errorMessage":"sdfxEffectName","messagePattern":"sdfxEffectName","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Effects/ShaderMixinManager.cs","lineNumber":30,"sourceCode":"    /// </summary>\n    public class ShaderMixinManager\n    {\n        private static readonly Dictionary<string, IShaderMixinBuilder> RegisteredBuilders = new Dictionary<string, IShaderMixinBuilder>();\n\n        /// <summary>\n        /// Registers a <see cref=\"IShaderMixinBuilder\"/> with the specified sdfx effect name.\n        /// </summary>\n        /// <param name=\"sdfxEffectName\">Name of the mixin.</param>\n        /// <param name=\"builder\">The builder.</param>\n        /// <exception cref=\"System.ArgumentNullException\">\n        /// sdfxEffectName\n        /// or\n        /// builder\n        /// </exception>\n        public static void Register(string sdfxEffectName, IShaderMixinBuilder builder)\n        {\n            if (sdfxEffectName == null)\n                throw new ArgumentNullException(\"sdfxEffectName\");\n\n            if (builder == null)\n                throw new ArgumentNullException(\"builder\");\n\n            lock (RegisteredBuilders)\n            {\n                RegisteredBuilders[sdfxEffectName] = builder;\n            }\n        }\n\n        /// <summary>\n        /// Determines whether the specified PDXFX effect is registered.\n        /// </summary>\n        /// <param name=\"sdfxEffectName\">Name of the PDXFX effect.</param>\n        /// <returns><c>true</c> if the specified PDXFX effect is registered; otherwise, <c>false</c>.</returns>\n        /// <exception cref=\"System.ArgumentNullException\">sdfxEffectName</exception>\n        public static bool Contains(string sdfxEffectName)\n        {","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Effects/ShaderMixinManager.cs#L12-L48","documentation":"ShaderMixinManager.Register throws ArgumentNullException(\"sdfxEffectName\") when the effect name used to register a mixin builder is null. The name is the lookup key in the global RegisteredBuilders dictionary. Fail-fast guard so unregistered/unnamed effects fail at registration rather than at mixin time.","triggerScenarios":"Calling ShaderMixinManager.Register(null, builder) — typically when the effect name comes from a type-derived name or constant that is null.","commonSituations":"Reflection-based registration where the name attribute is missing; refactors that removed the effect name constant.","solutions":["Pass a valid non-null effect name string","Ensure the constant/attribute providing the name is defined","Add a check that the derived name is non-null before calling Register"],"exampleFix":"// before\nShaderMixinManager.Register(GetEffectName(type), builder); // may return null\n// after\nvar name = GetEffectName(type);\nif (name != null) { ShaderMixinManager.Register(name, builder); }","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(sdfxEffectName)) throw new InvalidOperationException(\"Effect name required for builder registration\");\nShaderMixinManager.Register(sdfxEffectName, builder);","typeGuard":"static bool IsValidEffectName(string n) => !string.IsNullOrEmpty(n);","tryCatchPattern":"try { ShaderMixinManager.Register(name, builder); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"sdfxEffectName\") { logger.LogError(ex, \"Cannot register builder without a name\"); throw; }","preventionTips":["Define effect names as compile-time constants","Check reflection-derived names for null before registering","Register builders in explicit startup code rather than dynamic name derivation"],"tags":["csharp","null-argument","registration","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-23T08:17:48.524Z"}