BornToBeRoot/NETworkManager · error · InvalidOperationException

Failed to deserialize XML profile file.

Error message

Failed to deserialize XML profile file.

What it means

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.

Solutions

  1. Open the XML profile file and fix malformed markup (unclosed tags, invalid characters, encoding issues).
  2. Restore the legacy XML file from backup before attempting migration again.
  3. Skip migration by manually recreating the profiles in the new JSON format.
  4. Confirm the XML matches the legacy groups schema expected by DeserializeFromXmlStream.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at Source/NETworkManager.Profiles/ProfileManager.cs:1052 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BornToBeRoot/NETworkManager@2780d65469 (2026-09-12). Data as JSON: /api/errors/23aff4bf0c5b9a27. Report an issue: GitHub.

Appendix: source

Thrown at Source/NETworkManager.Profiles/ProfileManager.cs:1052

            GroupsSerializable = groupsSerializable
        };

        Log.Info("Successfully loaded profile file in legacy format. It will be migrated to new format on next save.");
    }

    /// <summary>
    ///     Method to deserialize a list of groups as <see cref="GroupInfo" /> from an XML stream.
    /// </summary>
    /// <param name="stream">Stream to deserialize.</param>
    [Obsolete("Legacy XML profile files are no longer used, but the method is kept for migration purposes.")]
    private static void DeserializeFromXmlStream(Stream stream)
    {
        XmlSerializer xmlSerializer = new(typeof(List<GroupInfoSerializable>));

        var groupsSerializable = xmlSerializer.Deserialize(stream) as List<GroupInfoSerializable>;

        if (groupsSerializable == null)
            throw new InvalidOperationException("Failed to deserialize XML profile file.");

        LoadedProfileFileData = new ProfileFileData
        {
            GroupsSerializable = groupsSerializable
        };
    }

    /// <summary>
    ///     Method to check if the byte array content is XML.
    /// </summary>
    /// <param name="data">Byte array to check.</param>
    /// <returns>True if the content is XML.</returns>
    [Obsolete("Legacy XML profile files are no longer used, but the method is kept for migration purposes.")]
    private static bool IsXmlContent(byte[] data)
    {
        if (data == null || data.Length == 0)
            return false;

View on GitHub (pinned to 2780d65469)