stride3d/stride · error · ArgumentNullException

Title can not be null

Error message

Title can not be null

What it means

Thrown by the GameWindow.Title setter when the assigned value is null. The window title must always be a valid string (empty is allowed, null is not), because it is passed to the underlying windowing system; assigning null raises ArgumentNullException with the message '<Title> can not be null'.

Solutions

  1. Assign a non-null string, using string.Empty if no title is desired
  2. Coalesce null values before assigning: title ?? string.Empty
  3. Fix the settings/localization source so the title resolves to a real value

Example fix

// before
window.Title = config.WindowTitle;
// after
window.Title = config.WindowTitle ?? "My Game";
Defensive patterns

Strategy: validation

Validate before calling

if (title == null) title = string.Empty;
window.Title = title;

Type guard

string SafeTitle(string? t) => t ?? string.Empty;

Try / catch

try { window.Title = value; } catch (ArgumentNullException ex) when (ex.ParamName == "value") { window.Title = string.Empty; }

Prevention

When it happens

Trigger: Assigning null to game.Window.Title directly, or assigning a variable/property that resolves to null (e.g. from missing config, failed localization lookup, or a null return from a title factory).

Common situations: Loading the window title from settings/JSON where the key is missing; localization dictionary miss returning null; passing a nullable field to Title without a null check.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/ffdf91da1d9402cd. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Games/GameWindow.cs:182

        /// </summary>
        /// <value><c>true</c> if this window has a border; otherwise, <c>false</c>.</value>
        public abstract bool IsBorderLess { get; set; }

        /// <summary>
        /// Gets or sets the title of the window.
        /// </summary>
        public string Title
        {
            get
            {
                return title;
            }

            set
            {
                if (value == null)
                {
                    throw new ArgumentNullException("value", $"{nameof(Title)} can not be null");
                }

                if (title != value)
                {
                    title = value;
                    SetTitle(title);
                }
            }
        }

        /// <summary>
        /// The size the window should have when switching from fullscreen to windowed mode,
        /// in window coordinates (points; equals pixels on Windows).
        /// To get the current actual size use <see cref="ClientBounds"/>.
        /// This gets overwritten when the user resizes the window.
        /// </summary>
        public Int2 PreferredWindowedSize { get; set; } = new Int2(768, 432);

View on GitHub (pinned to 96fad776d2)