dotnet / dotnet/msbuild

[Flaky Test] Microsoft.Build.UnitTests.TaskEnvironment_Tests.TaskEnvironment_SetEnvironment_ShouldReplaceAllVariables

Open
#14,570 0 comments 0 reactions 0 assignees View on GitHub
flaky-test
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

**Flaky-test key** (automated de-duplication — do not edit):
```text
flaky-test-id: Microsoft.Build.UnitTests.TaskEnvironment_Tests.TaskEnvironment_SetEnvironment_ShouldReplaceAllVariables
```

## Evidence

Repeatedly failing in test method cleanup (observed as "Test Method Cleanup Failure" in TRX logs) for both `environmentType: "Stub"` and `environmentType: "Multithreaded"` variants.

- **Distinct sources:** 3 (0 PRs + 3 rolling builds) per variant
- **Rolling builds:** [1514373](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1514373), [1517682](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1517682), [1527742](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1527742)
- **Legs:** CoreOnLinux
- **TFMs:** net10.0, net11.0
- **Assembly:** Microsoft.Build.Engine.UnitTests
- **First seen:** 2026-07-17 | **Last seen:** 2026-07-27

The failures appear in cleanup (after the test body completes), suggesting a resource leak or environment variable cleanup issue.

## Fully-qualified test name

`Microsoft.Build.UnitTests.TaskEnvironment_Tests.TaskEnvironment_SetEnvironment_ShouldReplaceAllVariables`

Source: `src/Build.UnitTests/BackEnd/TaskEnvironment_Tests.cs`

## Next steps

This test will be quarantined via `[ActiveIssue("https://github.com/dotnet/msbuild/issues/")]` (from `Microsoft.DotNet.XUnitV3Extensions`, namespace `Xunit`) until the underlying nondeterminism is fixed.

> [!WARNING]
>
> Firewall blocked 1 domain
>
> The following domain was blocked by the firewall during workflow execution:
>
> - `awmgmcpg`
>> To allow these domains, add them to the `network.allowed` list in your workflow frontmatter:
>
> ```yaml
> network:
> allowed:
> - defaults
> - "awmgmcpg"
> ```
>
> See [Network Configuration](https://github.github.com/gh-aw/reference/network/) for more information.
>
>

> Generated by [Flaky Test Triage](https://github.com/dotnet/msbuild/actions/runs/30451703648) · sonnet46 · 150.7 AIC · ⌖ 5.46 AIC · ⊞ 14.7K · [◷](https://github.com/search?q=repo%3Adotnet%2Fmsbuild+is%3Aissue+%22gh-aw-workflow-call-id%3A+dotnet%2Fmsbuild%2Fflaky-test-detector.agent%22&type=issues)

Contributor guide

No contributing guide indexed for this repository

Research direction

Read src/Build.UnitTests/BackEnd/TaskEnvironment_Tests.cs, focusing on TaskEnvironment_SetEnvironment_ShouldReplaceAllVariables and its cleanup behavior. Run the test for both Stub and Multithreaded variants on CoreOnLinux and compare the cleanup failures. Done means repeated runs complete without cleanup failures and the quarantine is no longer needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.