Bladed Knowledge Base

Bladed Batch 1.5 Root Element is Missing
Category: Bladed Batch

Problem

Symptoms:

GUI Error: 

Root Element Missing Error

Batch Log Entry: System.InvalidOperationException: There is an error in XML document (0, 0). ---> System.Xml.XmlException: Root element is missing

2021-10-07 11:50:38,387 [42] ERROR GH.BatchFramework.Client.Program - Global exceptionHandler caught

System.InvalidOperationException: There is an error in XML document (0, 0). ---> System.Xml.XmlException: Root element is missing.

   at System.Xml.XmlTextReaderImpl.Throw(Exception e)

   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()

   at System.Xml.XmlTextReaderImpl.Read()

   at System.Xml.XmlTextReader.Read()

   at System.Xml.XmlReader.MoveToContent()

   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderList1.Read3_ArrayOfRunnerId()

   --- End of inner exception stack trace ---

   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

   at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)

   at GH.Wolverine.Modules.Batch.Serialization.BatchFileSystemSerializer.ReadRunnerIds(BatchRun batchRun)

   at GH.Wolverine.Modules.Batch.Entities.Manager.ReadRunnerIds()

   at GH.Wolverine.Modules.Batch.Entities.Manager.ReRegisterExistingRunners()

   at GH.BatchFramework.Client.BatchClient.<>c__DisplayClass47_0.<TryObtainManagerService>b__0()

   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Threading.ThreadHelper.ThreadStart()

Cause:

The issue arises from the RunnerIds.xml file becoming corrupt somehow. The file gets recreated by the system so it is safe to delete if they encounter this issue. The worst case from deleting is that user may need to re-register existing "runners" to the Batch.



 
Solution

Resolution:

There is an entry in the stack that reads "at GH.Wolverine.Modules.Batch.Serialization.BatchFileSystemSerializer.ReadRunnerIds(BatchRun batchRun)". This tells you that it is the RunnerIds.xml file at fault. The same issue can affect other XML files and you determine which file is at fault by checking the trace.

If the file is either RunnerIds.xml or ViewerIds.xml then you may just delete the faulty file. In this example, the solution is to open an explorer window, go to the default Batch folder and delete the file named "RunnerIds.xml" then start Batch. It should hopefully start fine then. The default Batch folder is typically "%userprofile%\DNV GL\Batch\DefaultBatchDirectory".

If it is the root.batch file you would want to keep the file and try to fix it up if you can.

If it is a .joblist file you can look at the possibility of restoring it from a backup which is created by Batch each time it edits a .joblist file.





Keywords Batch; XML; Bladed; Root Element