{"record":{"id":"72f3f9e579157e8a","repo":"spectreconsole/spectre.console","slug":"value-cannot-be-null-parameter-text-72f3f9","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'text')","messagePattern":"Value cannot be null\\. \\(Parameter 'text'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Spectre.Console/Widgets/Table/TableTitle.cs","lineNumber":25,"sourceCode":"{\n    /// <summary>\n    /// Gets the title text.\n    /// </summary>\n    public string Text { get; }\n\n    /// <summary>\n    /// Gets or sets the title style.\n    /// </summary>\n    public Style? Style { get; set; }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"TableTitle\"/> class.\n    /// </summary>\n    /// <param name=\"text\">The title text.</param>\n    /// <param name=\"style\">The title style.</param>\n    public TableTitle(string text, Style? style = null)\n    {\n        Text = text ?? throw new ArgumentNullException(nameof(text));\n        Style = style;\n    }\n\n    /// <summary>\n    /// Sets the title style.\n    /// </summary>\n    /// <param name=\"style\">The title style.</param>\n    /// <returns>The same instance so that multiple calls can be chained.</returns>\n    public TableTitle SetStyle(Style? style)\n    {\n        Style = style ?? Spectre.Console.Style.Plain;\n        return this;\n    }\n\n    /// <summary>\n    /// Sets the title style.\n    /// </summary>\n    /// <param name=\"style\">The title style.</param>","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/spectreconsole/spectre.console/blob/0acc92fada6c42f13984e79c2b5f3d993bdfb099/src/Spectre.Console/Widgets/Table/TableTitle.cs#L7-L43","documentation":"The TableTitle constructor requires non-null text and throws ArgumentNullException on 'text' via Text = text ?? throw. TableTitle backs table Title and Caption; a null string is rejected so downstream markup rendering never sees null.","triggerScenarios":"new TableTitle(null); passing a nullable string that is null; assigning a title/caption from a source that can be null without coalescing.","commonSituations":"Optional title from config/data that is absent (null); a localized string resource resolving to null; reusing a title variable that was conditionally set.","solutions":["Null-coalesce: new TableTitle(text ?? string.Empty, style).","Skip setting the title/caption when the source is null instead of constructing TableTitle.","Validate the title source at the boundary before building the title object."],"exampleFix":"// before\ntable.Title = new TableTitle(maybeNullTitle);\n\n// after\nif (maybeNullTitle is not null)\n    table.Title = new TableTitle(maybeNullTitle);","handlingStrategy":"validation","validationCode":"if (text is null) return; // skip title\ntable.Title = new TableTitle(text, style);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Coalesce nullable title text with ?? string.Empty or skip setting the title.","Validate localized/config title sources for null before constructing TableTitle.","Enable nullable reference types to surface null title sources."],"tags":["table","title","null-reference","argument","constructor"],"backgroundTag":null,"analyzedSha":"0acc92fada6c42f13984e79c2b5f3d993bdfb099","analyzedAt":"2026-08-13T18:27:21.983Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}