{"record":{"id":"d67ff2a7f2dea8f1","repo":"peass-ng/PEASS-ng","slug":"can-t-get-instance-of-pi-propertytype-name","errorCode":null,"errorMessage":"Can't get instance of {pi.PropertyType.Name}.","messagePattern":"Can't get instance of (.+?)\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/TaskScheduler/XmlSerializationHelper.cs","lineNumber":463,"sourceCode":"                            {\n                                var mi = pi.PropertyType.GetMethod(\"Add\", new Type[] { typeof(object) });\n                                if (mi != null)\n                                    try { foreach (var i in par) mi.Invoke(pi.GetValue(obj, null), new object[] { i }); done = true; } catch { }\n                            }\n                            if (!done && et != typeof(Object))\n                            {\n                                var mi = pi.PropertyType.GetMethod(\"Add\", new Type[] { et });\n                                if (mi != null)\n                                    try { foreach (var i in par) mi.Invoke(pi.GetValue(obj, null), new object[] { i }); done = true; } catch { }\n                            }\n                            // Throw error if not done\n                        }\n                    }\n                    else\n                    {\n                        object inst = pi.GetValue(obj, null) ?? Activator.CreateInstance(pi.PropertyType);\n                        if (inst == null)\n                            throw new InvalidOperationException($\"Can't get instance of {pi.PropertyType.Name}.\");\n                        ReadObject(reader, inst, handler);\n                    }\n                }\n                else\n                {\n                    reader.Skip();\n                    reader.MoveToContent();\n                }\n            }\n        }\n\n        public static void ReadObject([NotNull] XmlReader reader, [NotNull] object obj, PropertyConversionHandler handler = null)\n        {\n            if (obj == null)\n                throw new ArgumentNullException(nameof(obj));\n\n            reader.MoveToContent();\n","sourceCodeStart":445,"sourceCodeEnd":481,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/TaskScheduler/XmlSerializationHelper.cs#L445-L481","documentation":"Reflection-fallback sentinel in ReadObjectProperties during XML deserialization: while populating a collection property, neither an Add(object) nor a strongly-typed Add(elementType) method could be found or successfully invoked on the property's type, so the library cannot build an instance of the property type from the XML and throws with the property type name substituted into the message. The faulting input is the XML being deserialized onto an object whose collection property lacks a usable Add method.","triggerScenarios":"Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/XmlSerializationHelper.cs:463 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the target property's type exposes a public Add method compatible with the element type (e.g. List<T> or a custom collection implementing Add)","Add a parameterless constructor and IXmlSerializable implementation to the property type so the deserializer can build it directly","Fix or regenerate the XML so it matches the expected object schema for that property"],"exampleFix":null,"handlingStrategy":"fallback","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"}