Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should still log a message even if AllowFailureWithoutError is set #6633

Closed
KirillOsenkov opened this issue Jun 28, 2021 · 0 comments · Fixed by #8125
Closed

Should still log a message even if AllowFailureWithoutError is set #6633

KirillOsenkov opened this issue Jun 28, 2021 · 0 comments · Fixed by #8125
Assignees
Labels
Area: Debuggability Issues impacting the diagnosability of builds, including logging and clearer error messages. Area: Logging bug help wanted Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim. triaged
Milestone

Comments

@KirillOsenkov
Copy link
Member

Looking at this logic:

// 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)
@KirillOsenkov KirillOsenkov added bug needs-triage Have yet to determine what bucket this goes in. Area: Debuggability Issues impacting the diagnosability of builds, including logging and clearer error messages. Area: Logging labels Jun 28, 2021
@rainersigwald rainersigwald added help wanted Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim. and removed needs-triage Have yet to determine what bucket this goes in. labels Jun 30, 2021
@rainersigwald rainersigwald added this to the Backlog milestone Jun 30, 2021
edvilme added a commit to edvilme/msbuild that referenced this issue Nov 3, 2022
benvillalobos pushed a commit that referenced this issue Nov 8, 2022
Co-authored-by: Rainer Sigwald <raines@microsoft.com>
Co-authored-by: Eduardo Villalpando Mello <t-eduardov@microsoft.com>
Fixes #6633
@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Debuggability Issues impacting the diagnosability of builds, including logging and clearer error messages. Area: Logging bug help wanted Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim. triaged
Projects
None yet
4 participants