{"record":{"id":"3c783a9265dfa1b5","repo":"peass-ng/PEASS-ng","slug":"items-in-collection-exceed-available-items-in-dest","errorCode":null,"errorMessage":"Items in collection exceed available items in destination array.","messagePattern":"Items in collection exceed available items in destination array\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/NamedValueCollection.cs","lineNumber":540,"sourceCode":"\n        bool ICollection<NameValuePair>.Contains(NameValuePair item)\n        {\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            {","sourceCodeStart":522,"sourceCodeEnd":558,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/NamedValueCollection.cs#L522-L558","documentation":"ICollection<NameValuePair>.CopyTo throws ArgumentException when the destination array cannot hold all items: array.Length - arrayIndex is smaller than the v2 collection count. The fault is in the caller's sizing/offset of the destination array, not in the collection contents.","triggerScenarios":"Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/NamedValueCollection.cs:540 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Allocate the destination array with at least Count + arrayIndex elements.","Use arrayIndex 0 with an array sized to Count for a simple full copy.","Use LINQ ToArray() instead of CopyTo to let the runtime size the array."],"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"}