We recently upgraded TFS from TFS 2015 to TFS 2018. We changed build agent in our infrastructure to new agent version 2.122.1
When developers commit their changesets or planed build is executed, sometimes build is processed as expected, but sometimes we receive an strange error upon retrieving sources from TFS repository.
In build log they are logged as:
2018-01-03T15:01:25.6074314Z Querying workspace information.
2018-01-03T15:01:26.5136788Z ##[error]There is an error in XML document (1, 1).
If I open agent detailed log, I got an following information:
[2018-01-03 15:01:25Z INFO ProcessInvoker] Starting process:
[2018-01-03 15:01:25Z INFO ProcessInvoker] File name: 'tf'
[2018-01-03 15:01:25Z INFO ProcessInvoker] Arguments: 'vc workspaces /format:xml /collection:http://servername:8080/tfs/ProjectCollection/ /loginType:OAuth /login:.,******** /noprompt'
[2018-01-03 15:01:25Z INFO ProcessInvoker] Working directory: 'C:\Agent2017\_work\10\s'
[2018-01-03 15:01:25Z INFO ProcessInvoker] Require exit code zero: 'True'
[2018-01-03 15:01:25Z INFO ProcessInvoker] Encoding web name: windows-1252 ; code page: '1252'
[2018-01-03 15:01:25Z INFO ProcessInvoker] Force kill process on cancellation: 'False'
[2018-01-03 15:01:25Z INFO ProcessInvoker] Process started with process id 3524, waiting for process exit.
[2018-01-03 15:01:25Z INFO JobServerQueue] Try to append 1 batches web console lines, success rate: 1/1.
[2018-01-03 15:01:25Z INFO JobServerQueue] Try to upload 1 log files or attachments, success rate: 1/1.
[2018-01-03 15:01:26Z INFO ProcessInvoker] Finished process with exit code 0, and elapsed time 00:00:00.5240505.
[2018-01-03 15:01:26Z ERR StepsRunner] Caught exception from step: System.InvalidOperationException: There is an error in XML document (1, 1). ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlReader.MoveToContent() at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderTFWorkspaces.Read5_Workspaces() --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, Object events) at System.Xml.Serialization.XmlSerializer.Deserialize(TextReader textReader) at Microsoft.VisualStudio.Services.Agent.Worker.Build.TFCommandManager.d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Services.Agent.Worker.Build.TfsVCSourceProvider.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Services.Agent.Worker.Build.BuildJobExtension.d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Services.Agent.Worker.JobExtensionRunner.d__20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.d__1.MoveNext() [2018-01-03 15:01:26Z INFO StepsRunner] Step result: Failed
It seems that agent is trying to get list of available workspaces, but it fails. If I try to execute command under appropriate permissions at computer, where agent is running, I get proper list of workspaces.