Skip to content

AllowFailureWithoutError is implemented backwards #5701

Closed

Description

Issue Description

AllowFailureWithoutError will not prevent the error MSB4181: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error. when set to true. It will prevent it when set to false. The default value is true.

This option was added in #5207

Steps to Reproduce

Have a task that does not write error into result, but returns false. See the MSB4181 error written to screen. Change the task and set AllowFailureWithoutError to true. See the error written to screen. Set the value to false. The error is no longer written to screen.

I am seeing this in dotnet test when any test fails and try to suppress the message because we don't write the error the correct MSBuild way. microsoft/vstest#2557

Expected Behavior

To not write the MSB4181 error on screen when AllowFailureWithoutError is set to true, not false. And for AllowFailureWithoutError to default to false, not true.

Actual Behavior

MSB4181 error is written to screen when AllowFailureWithoutError is set to true, not false. AllowFailureWithoutError defaults to true.

Analysis

if (taskReturned && !taskResult && !taskLoggingContext.HasLoggedErrors && (be is TaskHost th ? th.BuildRequestsSucceeded : false) && (be is IBuildEngine7 be7 ? be7.AllowFailureWithoutError : true))

This condition will write the MSB4181 when the condition is true.
(be is IBuildEngine7 be7 ? be7.AllowFailureWithoutError : true)) should negate AllowFailureWithoutError like this:
(be is IBuildEngine7 be7 ? !be7.AllowFailureWithoutError : true)).

I don't know where you set the default value.

Versions & Configurations

Microsoft (R) Build Engine version 16.8.0-preview-20429-01+d58e2b786 for .NET

Attach a binlog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions