{"record":{"id":"977005842a0d6d16","repo":"tui-cs/Terminal.Gui","slug":"y-cannot-be-null","errorCode":null,"errorMessage":"Y cannot be null","messagePattern":"Y cannot be null","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Terminal.Gui/ViewBase/View.Layout.cs","lineNumber":339,"sourceCode":"    ///         resulting in the\n    ///         view being laid out and redrawn as appropriate in the next iteration.\n    ///     </para>\n    ///     <para>\n    ///         Changing this property will cause <see cref=\"Frame\"/> to be updated.\n    ///     </para>\n    ///     <para>The default value is <c>Pos.Absolute (0)</c>.</para>\n    /// </remarks>\n    public Pos Y\n    {\n        get => _y;\n        set\n        {\n            if (Equals (_y, value))\n            {\n                return;\n            }\n\n            _y = value ?? throw new ArgumentNullException (nameof (value), @$\"{nameof (Y)} cannot be null\");\n            PosDimSet ();\n\n            NeedsClearScreenNextIteration ();\n        }\n    }\n\n    private Dim _height = Dim.Absolute (0);\n\n    /// <summary>\n    ///     Gets or sets the declarative height for the view.\n    /// </summary>\n    /// <value>The <see cref=\"Dim\"/> object representing the height of the view (the number of rows).</value>\n    /// <remarks>\n    ///     <para>\n    ///         See the View Layout Deep Dive for more information:\n    ///         <see href=\"https://tui-cs.github.io/Terminal.Gui/docs/layout.html\"/>\n    ///     </para>\n    ///     <para>","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/tui-cs/Terminal.Gui/blob/2e47b11478db083499917f2ad27c34d30efb0df1/Terminal.Gui/ViewBase/View.Layout.cs#L321-L357","documentation":"The Y property (vertical position) must be a non-null Pos. The layout engine cannot resolve a null vertical position — the default is Pos.Absolute(0), and null is treated as a programmer error.","triggerScenarios":"Assigning view.Y = null; or a Pos variable holding null because a computation or lookup returned nothing.","commonSituations":"Helper returning null Pos for an edge case, conditional setup that skips Y assignment, nullable field used before initialization.","solutions":["Use Pos.Absolute(n), Pos.Center(), Pos.Percent(n), or Pos.Top(otherView).","Default to Pos.Absolute(0) instead of null when clearing."],"exampleFix":"// before\nview.Y = computedPos;\n// after\nview.Y = computedPos ?? Pos.Absolute(0);","handlingStrategy":"validation","validationCode":"view.Y = pos ?? Pos.Absolute(0);","typeGuard":"static bool IsValidPos (Pos? p) => p is not null;","tryCatchPattern":null,"preventionTips":["Always provide a concrete Pos.","Default to Pos.Absolute(0).","Guard nullable Pos from helpers."],"tags":["layout","pos","y","validation"],"backgroundTag":null,"analyzedSha":"2e47b11478db083499917f2ad27c34d30efb0df1","analyzedAt":"2026-08-13T19:20:08.826Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}