{"record":{"id":"41ba5fdab615ed27","repo":"peass-ng/PEASS-ng","slug":"both-name-and-value-must-be-non-empty-strings","errorCode":null,"errorMessage":"Both name and value must be non-empty strings.","messagePattern":"Both name and value must be non-empty strings\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/NamedValueCollection.cs","lineNumber":39,"sourceCode":"        /// <summary>\n        /// Occurs when a property has changed.\n        /// </summary>\n        public event PropertyChangedEventHandler PropertyChanged;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"NameValuePair\"/> class.\n        /// </summary>\n        public NameValuePair() { }\n\n        internal NameValuePair([NotNull] ITaskNamedValuePair iPair)\n        {\n            v2Pair = iPair;\n        }\n\n        internal NameValuePair([NotNull] string name, [NotNull] string value)\n        {\n            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(value))\n                throw new ArgumentException(\"Both name and value must be non-empty strings.\");\n            this.name = name; this.value = value;\n        }\n\n        [XmlIgnore]\n        internal bool AttributedXmlFormat { get; set; } = true;\n\n        /// <summary>\n        /// Gets or sets the name.\n        /// </summary>\n        /// <value>\n        /// The name.\n        /// </value>\n        [NotNull]\n        public string Name\n        {\n            get { return v2Pair == null ? name : v2Pair.Name; }\n            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))); }\n        }","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/NamedValueCollection.cs#L21-L57","documentation":"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.","triggerScenarios":"Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/NamedValueCollection.cs:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate that both name and value are non-empty (string.IsNullOrEmpty) before constructing NameValuePair.","Skip or log entries that lack a name or value rather than adding them to the collection.","Substitute a meaningful placeholder value when real data may be empty."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}