{"record":{"id":"796e3adcb92e1745","repo":"peass-ng/PEASS-ng","slug":"notimplementedexception","errorCode":null,"errorMessage":"NotImplementedException","messagePattern":"NotImplementedException","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskFolderCollection.cs","lineNumber":77,"sourceCode":"                try\n                {\n                    if (v2FolderList != null)\n                        return parent.GetFolder(path);\n                    if (v1FolderList != null && v1FolderList.Length > 0 && (path == string.Empty || path == \"\\\\\"))\n                        return v1FolderList[0];\n                }\n                catch { }\n                throw new ArgumentException(@\"Path not found\", nameof(path));\n            }\n        }\n\n        /// <summary>Adds an item to the <see cref=\"ICollection{T}\"/>.</summary>\n        /// <param name=\"item\">The object to add to the <see cref=\"ICollection{T}\"/>.</param>\n        /// <exception cref=\"System.NotImplementedException\">\n        /// This action is technically unfeasible due to limitations of the underlying library. Use the <see\n        /// cref=\"TaskFolder.CreateFolder(string, string, bool)\"/> instead.\n        /// </exception>\n        public void Add([NotNull] TaskFolder item) => throw new NotImplementedException();\n\n        /// <summary>Removes all items from the <see cref=\"ICollection{T}\"/>.</summary>\n        public void Clear()\n        {\n            if (v2FolderList != null)\n            {\n                for (var i = v2FolderList.Count; i > 0; i--)\n                    parent.DeleteFolder(v2FolderList[i].Name, false);\n                OnNotifyPropertyChanged(nameof(Count));\n                OnNotifyPropertyChanged(IndexerName);\n                CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));\n            }\n        }\n\n        /// <summary>Determines whether the <see cref=\"ICollection{T}\"/> contains a specific value.</summary>\n        /// <param name=\"item\">The object to locate in the <see cref=\"ICollection{T}\"/>.</param>\n        /// <returns>true if <paramref name=\"item\"/> is found in the <see cref=\"ICollection{T}\"/>; otherwise, false.</returns>\n        public bool Contains([NotNull] TaskFolder item)","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/TaskFolderCollection.cs#L59-L95","documentation":"TaskFolderCollection.Add is part of the ICollection<TaskFolder> implementation but adding an existing folder object to the collection is impossible with the underlying Task Scheduler API, so it throws NotImplementedException. The library directs you to TaskFolder.CreateFolder instead, which actually creates a folder in the scheduler.","triggerScenarios":"Calling subFolders.Add(someTaskFolder) or passing the collection to code that calls Add (e.g. collection initializers, certain LINQ-to-collection helpers).","commonSituations":"Treating SubFolders like a List<TaskFolder>; using collection-initializer syntax on TaskService.RootFolder.SubFolders.","solutions":["Use TaskFolder.CreateFolder(path) instead of Add","Avoid APIs/initializers that call ICollection<T>.Add on SubFolders","Implement custom code that checks collection capabilities before Add"],"exampleFix":"// before\nts.RootFolder.SubFolders.Add(newFolder);\n// after\nts.RootFolder.CreateFolder(\"MyNewFolder\");","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { subFolders.Add(f); }\ncatch (NotImplementedException) { parent.CreateFolder(f.Name); }","preventionTips":["Never use Add/ICollection initializers on TaskFolderCollection","Use TaskFolder.CreateFolder for folder creation","Document that SubFolders is effectively read-only"],"tags":["task-scheduler","not-implemented","collection"],"backgroundTag":"collection-add-not-supported","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}