【发布时间】:2017-11-19 00:57:13
【问题描述】:
TFS 版本定义中的部署测试代理任务失败,出现以下异常:
未处理的异常: System.Management.Automation.PSInvalidOperationException: 不能从外部调用 WriteObject 和 WriteError 方法 覆盖 BeginProcessing、ProcessRecord 和 EndProcessing 方法,并且它们只能在同一个线程中调用。 验证 cmdlet 是否正确进行了这些调用,或联系 微软客户支持服务。 2017-06-16T08:49:49.9634068Z
在 System.Management.Automation.MshCommandRuntime.ThrowIfWriteNotPermitted(布尔 needToWriteToPipeline) 2017-06-16T08:49:49.9634068Z 在 System.Management.Automation.MshCommandRuntime.WriteHelper_ShouldWrite(ActionPreference 偏好,ContinueStatus lastContinueStatus) 2017-06-16T08:49:49.9634068Z 在 System.Management.Automation.MshCommandRuntime.WriteWarning(WarningRecord 记录,布尔覆盖查询)2017-06-16T08:49:49.9634068Z 在 System.Management.Automation.Cmdlet.WriteWarning(字符串文本) 2017-06-16T08:49:49.9634068Z 在 Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.Logger.WriteWarning(字符串 消息)2017-06-16T08:49:49.9634068Z 在 Microsoft.TeamFoundation.DistributedTask.Task.DistributedTestAutomation.TestAgentDownloader.wc_DownloadFileCompleted(对象 发件人,AsyncCompletedEventArgs e) 2017-06-16T08:49:49.9634068Z at System.Net.WebClient.OnDownloadFileCompleted(AsyncCompletedEventArgs e) 2017-06-16T08:49:49.9634068Z 在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext、ContextCallback 回调、对象状态、布尔值 preserveSyncCtx) 2017-06-16T08:49:49.9634068Z 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext、ContextCallback 回调、对象状态、布尔值 preserveSyncCtx) 2017-06-16T08:49:49.9634068Z 在 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() 2017-06-16T08:49:49.9634068Z 在 System.Threading.ThreadPoolWorkQueue.Dispatch() 2017-06-16T08:49:55.4477257Z ##[error]PowerShell 脚本完成 255 个错误。
如果未选中更新测试代理复选框,则任务成功执行。 这里提到的解决方案 https://github.com/Microsoft/vsts-tasks/issues/2964 和 https://social.msdn.microsoft.com/Forums/sqlserver/en-US/dae4c62d-cd23-40ad-83cf-2555d37c0bb9/test-agent-deployment-failing?forum=tfsbuild 似乎也不起作用
【问题讨论】:
-
嗨 Santhosh,有关于这个问题的更新信息吗?
-
@Patrick-MSFT 谢谢,会尽快更新。
-
@Patrick-MSFT 如果有任何其他方法可以克服此错误,请告诉我,我们遇到了这个问题,似乎是死路一条。谢谢。