{"record":{"id":"7234185ee2078d7c","repo":"stride3d/stride","slug":"expecting-value-0","errorCode":null,"errorMessage":"Expecting value > 0","messagePattern":"Expecting value > 0","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Serialization/SerializerSettings.cs","lineNumber":126,"sourceCode":"        public ChainedSerializer PreSerializer { get; set; }\n\n        /// <summary>\n        /// Gets or sets a serializer that is executed after all other serializers, including <see cref=\"TagTypeSerializer\"/>.\n        /// </summary>\n        public ChainedSerializer PostSerializer { get; set; }\n\n        /// <summary>\n        /// Gets or sets the preferred indentation. Default is 2.\n        /// </summary>\n        /// <value>The preferred indentation.</value>\n        /// <exception cref=\"System.ArgumentOutOfRangeException\">value;Expecting value &gt; 0</exception>\n        public int PreferredIndent\n        {\n            get { return preferredIndent; }\n            set\n            {\n                if (value < 1)\n                    throw new ArgumentOutOfRangeException(\"value\", \"Expecting value > 0\");\n                preferredIndent = value;\n            }\n        }\n\n        /// <summary>\n        /// Gets or sets a value indicating whether to emit anchor alias. Default is true.\n        /// </summary>\n        /// <value><c>true</c> to emit anchor alias; otherwise, <c>false</c>.</value>\n        public bool EmitAlias { get; set; }\n\n        /// <summary>\n        /// Gets or sets a value indicating whether to emit tags when serializing. Default is true.\n        /// </summary>\n        /// <value><c>true</c> to emit tags when serializing; otherwise, <c>false</c>.</value>\n        public bool EmitTags { get; set; }\n\n        /// <summary>\n        /// Gets or sets a value indicating whether the identation is trying to less","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Serialization/SerializerSettings.cs#L108-L144","documentation":"SerializerSettings.PreferredIndent rejects any value less than 1 with an ArgumentOutOfRangeException. The property controls the number of spaces used for YAML block indentation, which must be a positive integer for the emitter to produce valid nested output. It is a guard against misconfigured serializer settings.","triggerScenarios":"Setting `new SerializerSettings().PreferredIndent = 0` (or any negative number) before constructing a Serializer with those settings.","commonSituations":"Reading the indent value from a config file or environment variable where it defaults to 0, or computing it from user input without clamping.","solutions":["Set PreferredIndent to a positive integer (commonly 2 or 4)","Clamp or default the value when loading from configuration: `settings.PreferredIndent = Math.Max(1, configuredIndent)`"],"exampleFix":"// before\nvar settings = new SerializerSettings { PreferredIndent = indentFromConfig }; // 0\n// after\nvar settings = new SerializerSettings { PreferredIndent = indentFromConfig > 0 ? indentFromConfig : 2 };","handlingStrategy":"validation","validationCode":"if (settings.PreferredIndent < 1) settings.PreferredIndent = 2;","typeGuard":null,"tryCatchPattern":"try { settings.PreferredIndent = indent; } catch (ArgumentOutOfRangeException) { settings.PreferredIndent = 2; }","preventionTips":["Never assign indent values straight from config without clamping to >= 1","Default to 2 or 4, the common YAML conventions"],"tags":["yaml","serialization","argument-out-of-range","configuration"],"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-15T23:17:13.987Z"}