Open andersforsgren opened 5 months ago
This happens still,
Current agent version: '3.239.1'
...
##[error]Process 'msbuild.exe' exited with code ''.
Assuming this happens in azure-pipelines-tasks-lib (ToolFunctions.ps1):
Write-Verbose "Exit code: $LASTEXITCODE"
if ($RequireExitCodeZero -and $LASTEXITCODE -ne 0) {
Write-Error (Get-LocString -Key PSLIB_Process0ExitedWithCode1 -ArgumentList ([System.IO.Path]::GetFileName($FileName)), $LASTEXITCODE)
}
Is $LASTEXITCODE being unset really properly handled here?
When the process fails, the last project compiled looks like this with diagnostics on:
MyAssembly -> C:\TfsAgent\2\_work\1\b\MyAssembly.dll
##[debug]Processed: ##vso[task.logdetail id=a2d0fbce-2ff3-4051-933a-1b6bf83d692e;parentid=2f9f376e-54a7-4e8a-9111-009e62b62380;type=Build;result=Succeeded;finishtime=2024-08-06T12:59:55.6167709Z;progress=100;state=Completed;parentid=2f9f376e-54a7-4e8a-9111-009e62b62380;name=;]
##[debug]Processed: ##vso[task.logdetail id=2f9f376e-54a7-4e8a-9111-009e62b62380;parentid=6ebdce3e-7521-4440-9e33-5777f1abc1a5;type=Build;result=Succeeded;finishtime=2024-08-06T12:59:55.6167709Z;progress=100;state=Completed;parentid=6ebdce3e-7521-4440-9e33-5777f1abc1a5;name=;]
##[debug]Exit code:
##[debug]Error record:
##[debug]Invoke-VstsProcess : Process 'msbuild.exe' exited with code ''.
##[debug]At C:\TfsAgent\2\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.231.0\node_modules\azure-pipelines-tasks-msbuildhelpers\InvokeFunctions.ps1:126 char:17
##[debug]+ ... Invoke-VstsProcess -FileName $MSBuildPath -Arguments $arg ...
##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##[debug] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
##[debug] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-VstsProcess
##[debug]
##[debug]Script stack trace:
##[debug]at Invoke-Process, C:\TfsAgent\2\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.231.0\ps_modules\VstsTaskSdk\ToolFunctions.ps1: line 217
##[debug]at Invoke-MSBuild, C:\TfsAgent\2\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.231.0\node_modules\azure-pipelines-tasks-msbuildhelpers\InvokeFunctions.ps1: line 126
##[debug]at Invoke-BuildTools, C:\TfsAgent\2\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.231.0\node_modules\azure-pipelines-tasks-msbuildhelpers\InvokeFunctions.ps1: line 42
##[debug]at <ScriptBlock>, C:\TfsAgent\2\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.231.0\VSBuild.ps1: line 103
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]at <ScriptBlock>, <No file>: line 22
##[debug]at <ScriptBlock>, <No file>: line 18
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]Exception:
##[debug]Microsoft.PowerShell.Commands.WriteErrorException: Process 'msbuild.exe' exited with code ''.
##[error]Process 'msbuild.exe' exited with code ''.
##[debug]Processed: ##vso[task.logissue type=error]Process 'msbuild.exe' exited with code ''.
##[debug]Leaving Invoke-VstsProcess.
##[debug]Processed: ##vso[task.complete result=Failed]
##[debug]Processed: ##vso[task.logdetail finishtime=2024-08-06T12:59:55.8198861Z;id=6ebdce3e-7521-4440-9e33-5777f1abc1a5;progress=100;state=Completed;result=Failed]
##[debug]Leaving Invoke-MSBuild.
##[debug]Leaving Invoke-BuildTools.
##[debug]AGENT_VERSION: '3.239.1'
Could this be something that only happens on self-hosted agents?
I'm using self-hosted agents, and it looks to me that OP is too.
@DenisRumyantsev , @v-schhabra : my apologies for @-ing you but it looks like this has been triaged into Azure:Artifacts by a bot, where it is receiving no attention perhaps because it is not related to artifacts ?
Hi @chrisfcarroll Msbuild task is owned by ABTT team. I just tagged them here. I hope they will get notify now about this issue.
New issue checklist
Task name
MsBuild
Task version
1.231.5
Issue Description
After a successful compilation (the output assembly is produced OK and no errors or warnings are logged), the task fails and outputs the message
This happens intermittently and is hard to diagnose as there is no error output. It does not reproduce on a different machine or with a simple repro. What can I do to find this? In what situation would a process not set the exit code? I have looked through the windows event log to see any messages from msbuild.exe but that shows nothing.
Task configuration:
Environment type (Please select at least one enviroment where you face this issue)
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Windows 10
Relevant log output
Full task logs with system.debug enabled
Repro steps
No response