{"record":{"id":"23aff4bf0c5b9a27","repo":"BornToBeRoot/NETworkManager","slug":"failed-to-deserialize-xml-profile-file","errorCode":null,"errorMessage":"Failed to deserialize XML profile file.","messagePattern":"Failed to deserialize XML profile file\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"Source/NETworkManager.Profiles/ProfileManager.cs","lineNumber":1052,"sourceCode":"            GroupsSerializable = groupsSerializable\n        };\n\n        Log.Info(\"Successfully loaded profile file in legacy format. It will be migrated to new format on next save.\");\n    }\n\n    /// <summary>\n    ///     Method to deserialize a list of groups as <see cref=\"GroupInfo\" /> from an XML stream.\n    /// </summary>\n    /// <param name=\"stream\">Stream to deserialize.</param>\n    [Obsolete(\"Legacy XML profile files are no longer used, but the method is kept for migration purposes.\")]\n    private static void DeserializeFromXmlStream(Stream stream)\n    {\n        XmlSerializer xmlSerializer = new(typeof(List<GroupInfoSerializable>));\n\n        var groupsSerializable = xmlSerializer.Deserialize(stream) as List<GroupInfoSerializable>;\n\n        if (groupsSerializable == null)\n            throw new InvalidOperationException(\"Failed to deserialize XML profile file.\");\n\n        LoadedProfileFileData = new ProfileFileData\n        {\n            GroupsSerializable = groupsSerializable\n        };\n    }\n\n    /// <summary>\n    ///     Method to check if the byte array content is XML.\n    /// </summary>\n    /// <param name=\"data\">Byte array to check.</param>\n    /// <returns>True if the content is XML.</returns>\n    [Obsolete(\"Legacy XML profile files are no longer used, but the method is kept for migration purposes.\")]\n    private static bool IsXmlContent(byte[] data)\n    {\n        if (data == null || data.Length == 0)\n            return false;\n","sourceCodeStart":1034,"sourceCodeEnd":1070,"githubUrl":"https://github.com/BornToBeRoot/NETworkManager/blob/2780d65469917a296dbc15f206107d72e2d0115c/Source/NETworkManager.Profiles/ProfileManager.cs#L1034-L1070","documentation":"Save (and the encryption/password-change/rename flows) failed while deserializing a legacy XML profile file via DeserializeFromXmlStream. This path only exists for migrating obsolete XML profile files to the new JSON format, so the XML content is malformed, not well-formed, or does not match the legacy GroupInfo schema, and migration cannot complete.","triggerScenarios":"Thrown at Source/NETworkManager.Profiles/ProfileManager.cs:1052 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Open the XML profile file and fix malformed markup (unclosed tags, invalid characters, encoding issues).","Restore the legacy XML file from backup before attempting migration again.","Skip migration by manually recreating the profiles in the new JSON format.","Confirm the XML matches the legacy groups schema expected by DeserializeFromXmlStream."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2780d65469917a296dbc15f206107d72e2d0115c","analyzedAt":"2026-09-12T17:00:17.986Z","contentChangedAt":"2026-09-12T17:00:17.986Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}