{"record":{"id":"92c4001a9dab1c1a","repo":"spectreconsole/spectre.console","slug":"value-cannot-be-null-parameter-title","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'title')","messagePattern":"Value cannot be null\\. \\(Parameter 'title'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Spectre.Console/Widgets/Rule.cs","lineNumber":42,"sourceCode":"    public BoxBorder Border { get; set; } = BoxBorder.Square;\n\n    internal int TitlePadding { get; set; } = 2;\n    internal int TitleSpacing { get; set; } = 1;\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"Rule\"/> class.\n    /// </summary>\n    public Rule()\n    {\n    }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"Rule\"/> class.\n    /// </summary>\n    /// <param name=\"title\">The rule title markup text.</param>\n    public Rule(string title)\n    {\n        Title = title ?? throw new ArgumentNullException(nameof(title));\n    }\n\n    /// <inheritdoc/>\n    protected override IEnumerable<Segment> Render(RenderOptions options, int maxWidth)\n    {\n        var extraLength = (2 * TitlePadding) + (2 * TitleSpacing);\n\n        if (Title == null || maxWidth <= extraLength)\n        {\n            return GetLineWithoutTitle(options, maxWidth);\n        }\n\n        // Get the title and make sure it fits.\n        var title = GetTitleSegments(options, Title, maxWidth - extraLength);\n        if (Segment.CellCount(title) > maxWidth - extraLength)\n        {\n            // Truncate the title\n            title = Segment.TruncateWithEllipsis(title, maxWidth - extraLength);","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/spectreconsole/spectre.console/blob/0acc92fada6c42f13984e79c2b5f3d993bdfb099/src/Spectre.Console/Widgets/Rule.cs#L24-L60","documentation":"Thrown by the Rule(string) constructor when the title argument is null. Note the parameterless Rule() constructor is allowed (Title stays null and is handled in Render), but the string overload explicitly rejects null.","triggerScenarios":"Constructing 'new Rule(null)' or passing a null title variable to the string overload.","commonSituations":"Optional title from config that is absent; using the string overload where null was not intended.","solutions":["Use the parameterless 'new Rule()' if no title is needed.","Pass a non-null string or string.Empty.","Coalesce the title with '?? string.Empty'."],"exampleFix":"// before\nvar rule = new Rule(maybeNullTitle);\n\n// after\nvar rule = maybeNullTitle == null ? new Rule() : new Rule(maybeNullTitle);","handlingStrategy":"validation","validationCode":"var rule = title is null ? new Rule() : new Rule(title);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the parameterless Rule() when no title is needed.","Coalesce optional titles with '?? string.Empty'."],"tags":["rule","argument-null","constructor","spectre-console"],"backgroundTag":null,"analyzedSha":"0acc92fada6c42f13984e79c2b5f3d993bdfb099","analyzedAt":"2026-08-13T18:27:21.983Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}