peass-ng/PEASS-ng · error · ArgumentOutOfRangeException

Index is not a valid index in the TriggerCollection

Error message

Index is not a valid index in the TriggerCollection

What it means

Bounds sentinel for the TriggerCollection int indexer: the requested index is negative or >= Count, so the guard throws ArgumentOutOfRangeException before the underlying COM call (v2Coll indexing or v1Task.GetTrigger). The faulting input is the index argument; note the indexer is zero-based while the V2 path internally pre-increments (++index), which is internal detail only.

Source

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

                    Add(value);
            }
        }

        /// <summary>Gets a specified trigger from the collection.</summary>
        /// <param name="index">The index of the trigger to be retrieved.</param>
        /// <returns>Specialized <see cref="Trigger"/> instance.</returns>
        public Trigger this[int index]
        {
            get
            {
                if (v2Coll != null)
                    return Trigger.CreateTrigger(v2Coll[++index], v2Def);
                return Trigger.CreateTrigger(v1Task.GetTrigger((ushort)index));
            }
            set
            {
                if (index < 0 || Count <= index)
                    throw new ArgumentOutOfRangeException(nameof(index), index, @"Index is not a valid index in the TriggerCollection");
                var orig = this[index].Clone();
                inV2set = true;
                try
                {
                    Insert(index, value);
                    RemoveAt(index + 1);
                }
                finally
                {
                    inV2set = false;
                }
                OnNotifyPropertyChanged(IndexerName);
                CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, value, orig, index));
            }
        }

        object IList.this[int index]
        {

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Check index against the collection's Count property (0 <= index < Count) before accessing this[index]
  2. Enumerate the collection with foreach instead of positional indexing when index validity is uncertain
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/TriggerCollection.cs:114 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/ff42493eeae16d9e. Report an issue: GitHub.