{"record":{"id":"793d1435b63049de","repo":"spectreconsole/spectre.console","slug":"value-cannot-be-null-parameter-children","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'children')","messagePattern":"Value cannot be null\\. \\(Parameter 'children'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Spectre.Console/Widgets/Rows.cs","lineNumber":28,"sourceCode":"    /// <inheritdoc/>\n    public bool Expand { get; set; }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"Rows\"/> class.\n    /// </summary>\n    /// <param name=\"items\">The items to render as rows.</param>\n    public Rows(params IRenderable[] items)\n        : this((IEnumerable<IRenderable>)items)\n    {\n    }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"Rows\"/> class.\n    /// </summary>\n    /// <param name=\"children\">The items to render as rows.</param>\n    public Rows(IEnumerable<IRenderable> children)\n    {\n        _children = new List<IRenderable>(children ?? throw new ArgumentNullException(nameof(children)));\n    }\n\n    /// <inheritdoc/>\n    protected override Measurement Measure(RenderOptions options, int maxWidth)\n    {\n        if (Expand)\n        {\n            return new Measurement(maxWidth, maxWidth);\n        }\n        else\n        {\n            var measurements = _children.Select(c => c.Measure(options, maxWidth)).ToArray();\n            if (measurements.Length > 0)\n            {\n                return new Measurement(\n                    measurements.Max(c => c.Min),\n                    measurements.Max(c => c.Max));\n            }","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/spectreconsole/spectre.console/blob/0acc92fada6c42f13984e79c2b5f3d993bdfb099/src/Spectre.Console/Widgets/Rows.cs#L10-L46","documentation":"Thrown by the Rows(IEnumerable<IRenderable>) constructor when the children collection is null. The params overload delegates to this overload and passes the array; a null IEnumerable is rejected. An empty collection is allowed (renders nothing).","triggerScenarios":"Constructing 'new Rows((IEnumerable<IRenderable>)null)' or passing a list variable that is null.","commonSituations":"A filter/LINQ query that can return null, or a field that was never initialized.","solutions":["Pass a non-null collection; use Enumerable.Empty<IRenderable>() for no rows.","Coalesce with '?? Array.Empty<IRenderable>()'.","Initialize the source collection before constructing Rows."],"exampleFix":"// before\nvar rows = new Rows(maybeNullList);\n\n// after\nvar rows = new Rows(maybeNullList ?? Array.Empty<IRenderable>());","handlingStrategy":"type-guard","validationCode":"children ??= Array.Empty<IRenderable>();\nvar rows = new Rows(children);","typeGuard":"static bool HasValidRowsCollection(IEnumerable<IRenderable>? children) => children is not null;","tryCatchPattern":null,"preventionTips":["Coalesce potentially null collections with Array.Empty<IRenderable>().","Initialize source lists before constructing Rows."],"tags":["rows","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"}