peass-ng/PEASS-ng · error · RankException

Multi-dimensional arrays are not supported.

Error message

Multi-dimensional arrays are not supported.

What it means

Rank guard in the non-generic ICollection.CopyTo implementation of TriggerCollection: the destination Array has Rank != 1 (a multi-dimensional array), which the copy loop cannot fill, so RankException is thrown before any copying. The faulting input is the array argument's shape; a null array is handled separately by the standard null check.

Source

Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/TriggerCollection.cs:449

            if (Count > 1)
                return Properties.Resources.MultipleTriggers;
            return string.Empty;
        }

        void ICollection<Trigger>.Add(Trigger item) => Add(item);

        int IList.Add(object value)
        {
            Add((Trigger)value);
            return Count - 1;
        }

        bool IList.Contains(object value) => Contains((Trigger)value);

        void ICollection.CopyTo(Array array, int index)
        {
            if (array != null && array.Rank != 1)
                throw new RankException("Multi-dimensional arrays are not supported.");
            var src = new Trigger[Count];
            CopyTo(src, 0);
            Array.Copy(src, 0, array, index, Count);
        }

        IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();

        System.Xml.Schema.XmlSchema IXmlSerializable.GetSchema() => null;

        int IList.IndexOf(object value) => IndexOf((Trigger)value);

        void IList.Insert(int index, object value) => Insert(index, (Trigger)value);

        void IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement(XmlSerializationHelper.GetElementName(this), TaskDefinition.tns);
            while (reader.MoveToContent() == System.Xml.XmlNodeType.Element)
            {

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Pass a one-dimensional (rank-1) Trigger[] as the destination array
  2. Cast to the generic ICollection<Trigger> and use CopyTo(Trigger[], int), which gives compile-time dimension safety
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/TriggerCollection.cs:449 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02). Data as JSON: /api/errors/b9e3ed31066c2834. Report an issue: GitHub.