{"record":{"id":"61aa40e027a87121","repo":"stride3d/stride","slug":"unknown-bokeh-technique","errorCode":null,"errorMessage":"Unknown bokeh technique: ","messagePattern":"Unknown bokeh technique: ","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/Images/DepthOfField/BokehTechnique/BokehTechnique.cs","lineNumber":60,"sourceCode":"        /// Instantiates a new <see cref=\"BokehBlur\"/> from a technique name.\n        /// </summary>\n        /// <param name=\"name\"></param>\n        /// <returns>A Bokeh blur corresponding to the tehcnique specified.</returns>\n        public static BokehBlur ToBlurInstance(this BokehTechnique name)\n        {\n            switch (name)\n            {\n                case BokehTechnique.CircularGaussian:\n                    return new GaussianBokeh();\n\n                case BokehTechnique.HexagonalMcIntosh:\n                    return new McIntoshBokeh();\n\n                case BokehTechnique.HexagonalTripleRhombi:\n                    return new TripleRhombiBokeh();\n\n                default:\n                    throw new ArgumentOutOfRangeException(\"Unknown bokeh technique: \" + name);\n            }\n        }\n    }       \n}\n","sourceCodeStart":42,"sourceCodeEnd":65,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/Images/DepthOfField/BokehTechnique/BokehTechnique.cs#L42-L65","documentation":"BokehTechnique.CreateBokeh maps a BokehTechnique enum value to a concrete bokeh kernel instance. The default case throws ArgumentOutOfRangeException when the enum value is not one of the handled techniques. This guards against out-of-range enum casts or newly added enum members not yet implemented here.","triggerScenarios":"Calling CreateBokeh with a BokehTechnique value not covered by the switch, e.g. an enum value cast from an out-of-range int or a newer enum member than this switch handles.","commonSituations":"Deserializing a DoF render stage configuration from old/foreign data containing an unrecognized integer; adding a new BokehTechnique enum member without updating CreateBokeh; game save files carrying stale enum values across engine versions.","solutions":["Set the BokehTechnique property to a supported value (McIntosh or HexagonalTripleRhombi)","Check for int-to-enum casts and validate with Enum.IsDefined before passing","If a new enum member was added, update the switch in BokehTechnique.CreateBokeh to handle it"],"exampleFix":"// before\nbokeh.BokehTechnique = (BokehTechnique)saveData.bokehId;\n// after\nvar technique = (BokehTechnique)saveData.bokehId;\nif (!Enum.IsDefined(typeof(BokehTechnique), technique)) technique = BokehTechnique.McIntosh;\nbokeh.BokehTechnique = technique;","handlingStrategy":"validation","validationCode":"if (!Enum.IsDefined(typeof(BokehTechnique), technique)) throw new InvalidOperationException($\"Unsupported bokeh technique: {technique}\");","typeGuard":"bool IsValidBokehTechnique(BokehTechnique t) => Enum.IsDefined(typeof(BokehTechnique), t);","tryCatchPattern":"try { bokehInstance = BokehTechniqueHelper.CreateBokeh(technique); } catch (ArgumentOutOfRangeException) { bokehInstance = new McIntoshBokeh(); }","preventionTips":["Validate enum values with Enum.IsDefined before passing","Never cast raw ints to enums without checking range","Update the switch when adding new enum members"],"tags":["csharp","argumentoutofrange","enum","rendering"],"backgroundTag":"invalid-enum-value","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"}