You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Please stop lying about the exit code of an exec task #11821
The ToolTask.ExitCode property, and the corresponding task parameter, are documented as returning -1 if the process had 0 as the exit code but the task logged some errors. If you change the log output not to claim that the exit code is -1 in this case, and that change affects ToolTask.ExitCode too, please update its documentation. But I hope that the logging change can be made without affecting ToolTask.ExitCode.
Activity
MichalPavlik commentedon May 13, 2025
Triage: we should change the log message to stop lying :)
KalleOlaviNiemitalo commentedon May 21, 2025
The ToolTask.ExitCode property, and the corresponding task parameter, are documented as returning -1 if the process had 0 as the exit code but the task logged some errors. If you change the log output not to claim that the exit code is -1 in this case, and that change affects ToolTask.ExitCode too, please update its documentation. But I hope that the logging change can be made without affecting ToolTask.ExitCode.
https://github.com/MicrosoftDocs/visualstudio-docs/blob/f7e31b559b822491ab0dc8a2bb1d3d096ad7358c/docs/msbuild/includes/tooltaskextension-base-params.md?plain=1#L17
https://learn.microsoft.com/dotnet/api/microsoft.build.utilities.tooltask.exitcode
msbuild/src/Utilities/ToolTask.cs
Lines 114 to 119 in a7a4d5a
softworkz commentedon May 21, 2025
Changing the
ExitCodebehavior would be fatal I think.The change I'm suggesting is only about the log text, to something like:
"The command "xxxxxxx" exited with return value 0. Setting task ExitCode to -1 due to log output to STDERR."
(only in that specific case of course).
OvesN commentedon Mar 2, 2026
Resolved with this PR: #13303.
We now use a more descriptive message in this case.
softworkz commentedon Mar 2, 2026
Thanks!