stride3d/stride · error · ArgumentOutOfRangeException

Indices for Thickness run from 0 to 5, inclusive.

Error message

Indices for Thickness run from 0 to 5, inclusive.

What it means

Thrown by the Thickness indexer (this[int]) when index is outside [0, 5]. The indexer maps indices to the six components of the 3D thickness: 0=Left, 1=Top, 2=Front, 3=Right, 4=Bottom, 5=Back (as documented). Any other index cannot be resolved to a component, so an ArgumentOutOfRangeException with this message is thrown, matching the declared <exception> doc.

Solutions

  1. Validate or clamp the index to the [0, 5] range before using the Thickness indexer (0=Left, 1=Top, 2=Front, 3=Right, 4=Bottom, 5=Back).
  2. Replace dynamic indexer access with the named properties (Left, Top, Right, Bottom, Front, Back) whenever the component is known at compile time.
  3. Use a bounded for-loop (for i in 0..5) instead of an unbounded or data-driven index when iterating components.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at sources/engine/Stride.UI/Thickness.cs:146 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at sources/engine/Stride.UI/Thickness.cs:146

        /// 2 for the Front component, 3 for the Right component, 4 for the Bottom component, 5 for the Back component.</param>
        /// <returns>The value of the component at the specified index.</returns>
        /// <exception cref="System.ArgumentOutOfRangeException">Thrown when the <paramref name="index"/> is out of the range [0, 5].</exception>
        [DataMemberIgnore]
        public float this[int index]
        {
            get
            {
                switch (index)
                {
                    case 0: return Left;
                    case 1: return Top;
                    case 2: return Front;
                    case 3: return Right;
                    case 4: return Bottom;
                    case 5: return Back;
                }

                throw new ArgumentOutOfRangeException(nameof(index), $"Indices for {nameof(Thickness)} run from {0} to {5}, inclusive.");
            }
        }

        public bool Equals(Thickness other)
        {
            return Back.Equals(other.Back) && Bottom.Equals(other.Bottom)
                && Front.Equals(other.Front) && Left.Equals(other.Left)
                && Right.Equals(other.Right) && Top.Equals(other.Top);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            return obj is Thickness && Equals((Thickness)obj);
        }

        public override int GetHashCode()
        {

View on GitHub (pinned to 96fad776d2)