peass-ng/PEASS-ng · error · ArgumentException

Both name and value must be non-empty strings.

Error message

Both name and value must be non-empty strings.

What it means

The internal NameValuePair(string name, string value) constructor guards against null or empty strings for either the name or the value, throwing ArgumentException. It fires when a named value is created for the Task Scheduler v2 collection with blank data, since ITaskNamedValuePair requires both parts non-empty.

Source

Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/NamedValueCollection.cs:39

        /// <summary>
        /// Occurs when a property has changed.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Initializes a new instance of the <see cref="NameValuePair"/> class.
        /// </summary>
        public NameValuePair() { }

        internal NameValuePair([NotNull] ITaskNamedValuePair iPair)
        {
            v2Pair = iPair;
        }

        internal NameValuePair([NotNull] string name, [NotNull] string value)
        {
            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(value))
                throw new ArgumentException("Both name and value must be non-empty strings.");
            this.name = name; this.value = value;
        }

        [XmlIgnore]
        internal bool AttributedXmlFormat { get; set; } = true;

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>
        /// The name.
        /// </value>
        [NotNull]
        public string Name
        {
            get { return v2Pair == null ? name : v2Pair.Name; }
            set { if (string.IsNullOrEmpty(value)) throw new ArgumentNullException(nameof(Name)); if (v2Pair == null) name = value; else v2Pair.Name = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Name))); }
        }

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Validate that both name and value are non-empty (string.IsNullOrEmpty) before constructing NameValuePair.
  2. Skip or log entries that lack a name or value rather than adding them to the collection.
  3. Substitute a meaningful placeholder value when real data may be empty.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/NamedValueCollection.cs:39 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/41ba5fdab615ed27. Report an issue: GitHub.