mRemoteNG/mRemoteNG · error · FileFormatException

Unknown file version

Error message

Unknown file version

What it means

Thrown by RemoteDesktopConnectionManagerDeserializer.VerifyFileVersion when the <RDCMan> element has neither a programVersion attribute nor a <version> child node. With no version information at all the importer cannot pick a parsing strategy and aborts with FileFormatException("Unknown file version").

Source

Thrown at mRemoteNG/Config/Serializers/MiscSerializers/RemoteDesktopConnectionManagerDeserializer.cs:79

                if (!(version == new Version(2, 7)) && !(version == new Version(2, 83)))
                {
                    throw new FileFormatException($"Unsupported file version ({version}).");
                }
            }
            else
            {
                string versionNode = rdcManNode?.SelectSingleNode("./version")?.InnerText;
                if (versionNode != null)
                {
                    Version version = new(versionNode);
                    if (!(version == new Version(2, 2)))
                    {
                        throw new FileFormatException($"Unsupported file version ({version}).");
                    }
                }
                else
                {
                    throw new FileFormatException("Unknown file version");
                }
            }
        }

        private static void ImportFileOrGroup(XmlNode xmlNode, ContainerInfo parentContainer)
        {
            ContainerInfo newContainer = ImportContainer(xmlNode, parentContainer);

            XmlNodeList childNodes = xmlNode.SelectNodes("./group|./server");
            if (childNodes == null) return;
            foreach (XmlNode childNode in childNodes)
            {
                // ReSharper disable once SwitchStatementMissingSomeCases
                switch (childNode.Name)
                {
                    case "group":
                        ImportFileOrGroup(childNode, newContainer);
                        break;

View on GitHub (pinned to 9211babf35)

Solutions

  1. Confirm the file is a genuine RDCMan .rdg export by opening it; a valid file has programVersion or a <version> node.
  2. Re-export the connections from RDCMan 2.7.
  3. If authoring .rdg programmatically, always include programVersion="2.7" and schemaVersion="3".
  4. Surface a clear 'unrecognized RDCMan file' message to the user instead of relying on the raw exception.

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

XmlNode rdcMan = xmlDocument.SelectSingleNode("/RDCMan");
bool hasVersion = rdcMan?.Attributes?["programVersion"] != null
               || rdcMan?.SelectSingleNode("./version") != null;
if (!hasVersion) throw new FileFormatException("File has no RDCMan version information; not a valid .rdg export.");

Type guard

static bool HasAnyRdcManVersion(XmlNode rdcMan) =>
    rdcMan?.Attributes?["programVersion"] != null || rdcMan?.SelectSingleNode("./version") != null;

Try / catch

try { deserializer.Deserialize(xml); }
catch (FileFormatException ex) when (ex.Message.Contains("Unknown file version"))
{ throw new InvalidOperationException("Selected file is not a recognizable RDCMan export.", ex); }

Prevention

When it happens

Trigger: Importing an .rdg file whose <RDCMan> root omits both programVersion attribute and <version> element — typically a hand-authored, truncated, or wrong-format XML file that nonetheless has an <RDCMan> root.

Common situations: User selected an XML file that is not a real RDCMan export; file corrupted/truncated during transfer; export from a tool that strips version metadata.

Related errors


AI-assisted analysis of mRemoteNG/mRemoteNG@9211babf35 (2026-08-13). Data as JSON: /api/errors/ef20131e70f93305. Report an issue: GitHub.