TFS Database Backup Error: There is an error in the XML document - but which Doc?

Our overnight TFS 2012 backup just started to crash. It also fails when run directly through the TFS Express admin console.

Which file is the following error actually referencing? If I can find it, I can fix the "Root element is missing" error :)

[13/08/2014 23:00:00] [Info] Full database backup job
[13/08/2014 23:00:00] [Info] Getting backup lock
[13/08/2014 23:00:05] [Error] 
Exception Message: There is an error in XML document (0, 0). (type   InvalidOperationException)
Exception Stack Trace:    at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at Microsoft.TeamFoundation.Admin.BackupSets.Load(String folder)
   at Microsoft.TeamFoundation.Admin.Jobs.FullDatabaseBackupJobExtension.Run(TeamFoundationRequestContext requestContext, TeamFoundationJobDefinition jobDefinition, DateTime jobQueueTime, String& resultMessage)

Inner Exception Details:

Exception Message: Root element is missing. (type XmlException)
Exception Stack Trace:    at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlReader.MoveToContent()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderBackupSets.Read7_BackupSets()

[13/08/2014 23:00:05] [Info] Full Backups Failed

      

Thank.

+3


source to share


3 answers


Take a look at the folder where your backups are configured. there will be an XML file there, can't remember the name, but there might be something like BackupSets.xml



+3


source


Dylan answered my original question about where to find the unspecified xml file that was in error, but in case he helps anyone else ...

The Backupsets.xml file is empty. Why I don't know ... An attempt to set up a backup via the TFS Express admin console also failed with the same error, so I

  • Deleted Backupsets.xml file altogether
  • Reconfigured backups using the wizard. Now when he didn't find the xml file he created a new one.
  • Perform a full backup - it was successful. Hopefully the scheduled backups will now also work from now on.


NB Created Backupsets.xml file (before the first full backup):

<?xml version="1.0"?>
<BackupSets xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Version>1</Version>
  <BackupSets />
</BackupSets>

      

+6


source


FIX (user workaround):

  • Rename the BackupSets.xml file to the backup folder
  • Re-run full backup *

    • In the TFS Administrator Console, select Scheduled Backup, then click Finish Full Backup. Or use command line, PowerShell script, API call as desired.

CAUSE: The backupsets.xml in the backup destination does not contain valid XML.

  • Why is this crashing? The backup wizard opens backupsettings.xml, then calls the System.Xml.Serialization.XmlSerializer.Deserialize XML deserializer function, preparing to add a new entry. Invalid XML content, including empty / null byte or text content, will result in a deserialization exception.

PRODUCTS AFFECT: Repro confirmed in TFS2010 and 2017-11-25 I have reproduced with TFS2015 SP3: -O

The fix is ​​pretty simple ... once you understand what's going on. -Zephan


MICROSOFT BUGFIX CODE / Feature Improvement Request:

BACKUP Exception Handling Wizard for backups.xml to deserialize or parse exceptions.

  • If the XML deserialization fails, close backupsets.xml, rename it to backupsets-YYMMDD-hhmm-corrupt-backup.xml, and then navigate to the backupsets.xml file that was not found.

DIFFERENCE: HIGH (data loss)

  • This is a longstanding problem that can result in significant data loss. I've personally seen over 1 month of data loss due to this issue, silently blocking backups and making all earlier restore settings unusable (since parsing BackupSets.xml is VERY bogus, I couldn't even hack restoring the last successful backup.)
0


source







All Articles