-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Should still log a message even if AllowFailureWithoutError is set #6633
Copy link
Copy link
Closed
Labels
Area: DebuggabilityIssues impacting the diagnosability of builds, including logging and clearer error messages.Issues impacting the diagnosability of builds, including logging and clearer error messages.Area: Loggingbughelp wantedIssues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim.Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim.triaged
Milestone
Description
Looking at this logic:
msbuild/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs
Lines 937 to 958 in e9593e8
| // When a task fails it must log an error. If a task fails to do so, | |
| // that is logged as an error. MSBuild tasks are an exception because | |
| // errors are not logged directly from them, but the tasks spawned by them. | |
| IBuildEngine be = host.TaskInstance.BuildEngine; | |
| if (taskReturned && !taskResult && !taskLoggingContext.HasLoggedErrors && (be is TaskHost th ? th.BuildRequestsSucceeded : false) && (be is IBuildEngine7 be7 ? !be7.AllowFailureWithoutError : true)) | |
| { | |
| if (_continueOnError == ContinueOnError.WarnAndContinue) | |
| { | |
| taskLoggingContext.LogWarning(null, | |
| new BuildEventFileInfo(_targetChildInstance.Location), | |
| "TaskReturnedFalseButDidNotLogError", | |
| _taskNode.Name); | |
| taskLoggingContext.LogComment(MessageImportance.Normal, "ErrorConvertedIntoWarning"); | |
| } | |
| else | |
| { | |
| taskLoggingContext.LogError(new BuildEventFileInfo(_targetChildInstance.Location), | |
| "TaskReturnedFalseButDidNotLogError", | |
| _taskNode.Name); | |
| } | |
| } |
we should still log a message if AllowFailureWithoutError is set. If it's set, currently we log nothing, and that's makes it impossible to debug. We should log a message instead of logging nothing at all.
See here microsoft/vstest#2953 for a real-world scenario where this would have helped a lot. VSTest sets AllowFailureWithoutError so we get ye olde
Build FAILED.
0 Warning(s)
0 Error(s)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area: DebuggabilityIssues impacting the diagnosability of builds, including logging and clearer error messages.Issues impacting the diagnosability of builds, including logging and clearer error messages.Area: Loggingbughelp wantedIssues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim.Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim.triaged
Type
Fields
Give feedbackNo fields configured for issues without a type.