AvaloniaUI/Avalonia · warning · ArgumentException

Overlap alignment mismatch.

Error message

Overlap alignment mismatch.

What it means

Centralized ThrowHelper.ThrowArgumentException_OverlapAlignmentMismatch throws ArgumentException "Overlap alignment mismatch." It is ported from the .NET BCL ThrowHelper for span/array copy operations where source and destination overlap in a way that is not allowed. In the current Avalonia codebase it has no active call site (grep finds only the definition), so it is effectively reserved/vestigial — a normal Avalonia user cannot reach it through PooledList/PooledStack public APIs.

Source

Thrown at src/Avalonia.Base/Collections/Pooled/ThrowHelper.cs:76

            throw new IndexOutOfRangeException();
        }

        [DoesNotReturn]
        internal static void ThrowArgumentOutOfRangeException()
        {
            throw new ArgumentOutOfRangeException();
        }

        [DoesNotReturn]
        internal static void ThrowArgumentException_DestinationTooShort()
        {
            throw new ArgumentException("Destination too short.");
        }

        [DoesNotReturn]
        internal static void ThrowArgumentException_OverlapAlignmentMismatch()
        {
            throw new ArgumentException("Overlap alignment mismatch.");
        }

        [DoesNotReturn]
        internal static void ThrowArgumentOutOfRange_IndexException()
        {
            throw GetArgumentOutOfRangeException(ExceptionArgument.index,
                                                    ExceptionResource.ArgumentOutOfRange_Index);
        }

        [DoesNotReturn]
        internal static void ThrowIndexArgumentOutOfRange_NeedNonNegNumException()
        {
            throw GetArgumentOutOfRangeException(ExceptionArgument.index,
                                                    ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
        }

        [DoesNotReturn]
        internal static void ThrowValueArgumentOutOfRange_NeedNonNegNumException()

View on GitHub (pinned to 11c5427268)

Solutions

  1. This is not reachable via public Avalonia collection APIs today — verify you are not calling an internal helper.
  2. If you maintain a fork that calls overlapping copies, ensure source and destination do not overlap, or are aligned when they do.
  3. Report it if it appears unexpectedly, since it indicates a code path that was assumed unreachable.
Defensive patterns

Strategy: validation

Validate before calling

// Unreachable via public APIs today. If you fork overlapping-copy helpers:
// ensure source and destination spans do not overlap before copying.

Prevention

When it happens

Trigger: Would be invoked by internal array/span copy code that detects overlapping source and destination whose alignment makes a copy undefined. No public PooledList/PooledStack method in this tree currently routes to it.

Common situations: Effectively unreachable through the public API; could surface only if future internal copy helpers wire it up. Seeing it implies a custom/internal caller was added.

Related errors


AI-assisted analysis of AvaloniaUI/Avalonia@11c5427268 (2026-08-13). Data as JSON: /api/errors/73d3e44c491bd14b. Report an issue: GitHub.