{"record":{"id":"67774381528e1b09","repo":"peass-ng/PEASS-ng","slug":"invalid-days-of-the-week-element","errorCode":null,"errorMessage":"Invalid days of the week element.","messagePattern":"Invalid days of the week element\\.","errorType":"exception","errorClass":"System.Xml.XmlException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/Trigger.cs","lineNumber":2637,"sourceCode":"            {\n                switch (reader.LocalName)\n                {\n                    case \"WeeksInterval\":\n                        WeeksInterval = (short)reader.ReadElementContentAsInt();\n                        break;\n\n                    case \"DaysOfWeek\":\n                        reader.Read();\n                        DaysOfWeek = 0;\n                        while (reader.MoveToContent() == System.Xml.XmlNodeType.Element)\n                        {\n                            try\n                            {\n                                DaysOfWeek |= (DaysOfTheWeek)Enum.Parse(typeof(DaysOfTheWeek), reader.LocalName);\n                            }\n                            catch\n                            {\n                                throw new System.Xml.XmlException(\"Invalid days of the week element.\");\n                            }\n                            reader.Read();\n                        }\n                        reader.ReadEndElement();\n                        break;\n\n                    default:\n                        reader.Skip();\n                        break;\n                }\n            }\n            reader.ReadEndElement();\n        }\n\n        /// <summary>Writes the subclass XML for V1 streams.</summary>\n        /// <param name=\"writer\">The writer.</param>\n        private void WriteMyXml(System.Xml.XmlWriter writer)\n        {","sourceCodeStart":2619,"sourceCodeEnd":2655,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/Trigger.cs#L2619-L2655","documentation":"When reading a trigger definition from XML, an unknown/invalid element name inside the DaysOfWeek block cannot be parsed into the DaysOfTheWeek enum, and the library rethrows it as XmlException('Invalid days of the week element.'). The XML contains a day-of-week value outside the expected names (Monday..Sunday, AllDays, etc.).","triggerScenarios":"Importing/reading task XML (ReadXml on a trigger) whose <DaysOfWeek> child element name is not a valid DaysOfTheWeek enum name — misspelled day, localized day names, or numeric values.","commonSituations":"Hand-edited or third-party-generated task XML with e.g. <Mon/> instead of <Monday/>, localized XML from non-English tooling, or corrupted export files.","solutions":["Fix the DaysOfWeek XML elements to use canonical English enum names (Monday, Tuesday, ...)","Validate the XML against the Task Scheduler schema before import","Wrap ReadXml in try-catch for XmlException and repair or reject the file"],"exampleFix":"// before\n<DaysOfWeek><Mon/><Wed/></DaysOfWeek>\n// after\n<DaysOfWeek><Monday/><Wednesday/></DaysOfWeek>","handlingStrategy":"validation","validationCode":"static readonly string[] ValidDays = { \"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\" };\nstatic bool DaysOfWeekXmlValid(XElement days) =>\n    days?.Elements().All(e => ValidDays.Contains(e.Name.LocalName, StringComparer.Ordinal)) ?? true;","typeGuard":null,"tryCatchPattern":"try { trigger.ReadXml(reader); }\ncatch (System.Xml.XmlException ex) when (ex.Message.Contains(\"days of the week\")) { /* repair DaysOfWeek section or reject file */ }","preventionTips":["Generate task XML only with canonical English day names","Validate imports against the Task Scheduler XML schema","Never hand-edit or localize DaysOfWeek elements in task XML"],"tags":["task-scheduler","xml","days-of-week","trigger"],"backgroundTag":"invalid-xml-enum-value","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}