Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Get Source on remote agent



  • I'm trying to build on a remote agent and cannot get past TFS-GetSource. The command runs perfectly on the local agent which does me no good since the local agent does not have SharePoint 2016 installed. I need to build this on the remote agent. The old version of BuildMaster was easy to troubleshoot as the execution log was VERY verbose by providing the actual commands being executed. On this version, it's not at all verbose which is making it very difficult to troubleshoot without having to ask here.

    Error received while trying to execute TFS-GetSource on remote agent:

    Unhandled exception: System.NullReferenceException: Object reference not set to an instance of an object.
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Inedo.Agents.InedoAgentClientBase.<SendMessageAsync>d__28.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Inedo.Agents.InedoAgentClientBase.<ExecuteCommandAsync>d__26`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Inedo.BuildMaster.Extensibility.Agents.TcpAgent.<Inedo-Agents-IRemoteJobExecuter-ExecuteJobAsync>d__34.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Inedo.BuildMaster.Extensibility.Operations.RemoteExecuteOperation.<ExecuteAsync>d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Inedo.BuildMaster.Windows.ServiceApplication.Executions.PlanExecuter.DeploymentPlanExecuter.<Inedo-ExecutionEngine-Executer-IExecutionHostEnvironment-ExecuteActionAsync>d__21.MoveNext()

    Product: BuildMaster
    Version: 5.6.4



  • Quick follow-up. I decided to review the TFS Extension code and found the following lines that may be the cause of the issue (can't be certain).

        protected string GetRootWorkspaceDiskPath()
        {
            using (var agent = BuildMasterAgent.CreateLocalAgent())
            {
                return PathEx.Combine(agent.GetService<IFileOperationsExecuter>().GetBaseWorkingDirectory(), "TfsWorkspaces");
            }
        }
    

    Is this trying to create the "LocalAgent" which refers to the local agent on the Build Master Server? Should it be checking to see if the target agent server is remote and call BuildMasterAgent.Create(string serverName), BuildMasterAgent.Create(int serverId), or BuildMasterAgent.Create(Tables.Servers serverInfo)?

    The Object reference error appears to occur immediately after the LogInformation() step under RemoteExecuteAsync in GetSourceOperation.cs. The method this.GetRootWorkspaceDiskPath() sticks out as a possible candidate, which is where I found the code above.



  • Thanks Paul; we're still investigating and trying to reproduce. The error in the stack trace, is unfortunately, not helpful as you're probably noticing...

    Thanks for looking, second set of eyes is always helpful! In this case, because GetSourceOperation inherits RemoteExecuteOperation (via RemoteTfsOperation), the entire RemoteExecuteAsync method is executed on the agent.

    So, the LocalAgent is just how we do file operations on the (current) server; we don't use System.IO methods directly.



  • Thanks Alana. I appreciate the help.

    To help isolate the issue, I've forked the TFS extension and deployed to our BM server with remote debugging. I was not able to investigate the exact error with the remote debugging, but I was able to determine that the exception occurs on line 49 in RemoteTfsOperation.cs which is the following:

    using(var agent = BuildMasterAgent.CreateLocalAgent())

    I'll add some debugging there and see if I can capture more information about the error.



  • Thanks for the debugging pointer - a dev was able to reproduce and submit a fix. There will be a new version of the extension released shortly.



  • Hi Tod,

    Thank you! I'm never sure if I'm being helpful or just getting in the way. Just can't sit still long enough :).



Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation