Skip to content

[Bug] [Flaky test]: CanceledTasksDoNotLogMSB4181 unit test is unreliable #9298

Description

@jrdodds

Issue Description

Unit test Microsoft.Build.UnitTests.BackEnd.TaskBuilder_Tests.CanceledTasksDoNotLogMSB4181 failed on a PR build.

Shouldly.ShouldAssertException : logger.WarningCount
    should be
1
    but was
0

The test includes a Thread.Sleep call.

Steps to Reproduce

The issue was found when running the set of unit tests during a PR build but it appears to be a threading race condition and the test doesn't consistently break.

Expected Behavior

The test should pass for the PR build where it failed.

Actual Behavior

The test failed for Windows Core while passing for the other type of builds within the PR build.

Analysis

Related to:
#9277
#9100

A search in the repo shows that Thread.Sleep appears 163 times in 32 files. About 22 of the files appear to be unit tests or test support.

Versions & Configurations

No response

Metadata

Metadata

Assignees

Labels

Area: Our Own BuildProblems affecting the build or build infrastructure of the MSBuild repo itself.Priority:2Work that is important, but not critical for the releasebugflaky-testTests that have failed but passed on rerun.triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions