{"record":{"id":"8d7300792246a9df","repo":"peass-ng/PEASS-ng","slug":"array-index-must-be-0-or-greater","errorCode":null,"errorMessage":"Array index must be 0 or greater.","messagePattern":"Array index must be 0 or greater\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/NamedValueCollection.cs","lineNumber":542,"sourceCode":"        {\n            if (v2Coll == null)\n                return unboundDict.Contains(item);\n\n            foreach (var invp in this)\n                if (Equals(item, invp)) return true;\n            return false;\n        }\n\n        void ICollection<NameValuePair>.CopyTo(NameValuePair[] array, int arrayIndex)\n        {\n            if (v2Coll == null)\n                unboundDict.CopyTo(array, arrayIndex);\n            else\n            {\n                if (array.Length - arrayIndex < v2Coll.Count)\n                    throw new ArgumentException(\"Items in collection exceed available items in destination array.\");\n                if (arrayIndex < 0)\n                    throw new ArgumentException(@\"Array index must be 0 or greater.\", nameof(arrayIndex));\n                for (var i = 0; i < v2Coll.Count; i++)\n                    array[i + arrayIndex] = new NameValuePair(v2Coll[i]);\n            }\n        }\n\n        bool ICollection<NameValuePair>.IsReadOnly => false;\n\n        ICollection<string> IDictionary<string, string>.Keys => Names;\n\n        bool ICollection<KeyValuePair<string, string>>.IsReadOnly => false;\n\n        bool ICollection<NameValuePair>.Remove(NameValuePair item)\n        {\n            var i = -1;\n            try\n            {\n                if (v2Coll == null)\n                {","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/NamedValueCollection.cs#L524-L560","documentation":"ICollection<NameValuePair>.CopyTo rejects a negative arrayIndex with ArgumentException ('Array index must be 0 or greater.'). A negative start offset is meaningless for a copy operation, so the at-fault input is the negative index argument supplied by the caller.","triggerScenarios":"Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/NamedValueCollection.cs:542 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Clamp or validate arrayIndex >= 0 before calling CopyTo.","Pass 0 as arrayIndex when copying into a freshly allocated array.","Fix the upstream computation that produced the negative offset."],"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"}