[Flaky Test] Microsoft.Build.UnitTests.TaskEnvironment_Tests.TaskEnvironment_SetEnvironment_ShouldReplaceAllVariables
- 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
This test has been observed failing intermittently as **Test Method Cleanup Failures** across 3 distinct rolling builds on `main` (0 PRs), on the `CoreOnLinux` leg in `net10.0` and `net11.0`.
- **Assembly:** `Microsoft.Build.Engine.UnitTests`
- **Fully-qualified name:** `Microsoft.Build.UnitTests.TaskEnvironment_Tests.TaskEnvironment_SetEnvironment_ShouldReplaceAllVariables`
- **Failing variants (cleanup failures):**
- `environmentType: "Multithreaded"`
- `environmentType: "Stub"`
- **Legs:** CoreOnLinux
- **TFMs:** net10.0, net11.0
- **Distinct rolling builds:** 3 ([1517682](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1517682), [1527742](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1527742), [1532844](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1532844))
- **First seen:** 2026-07-20
- **Last seen:** 2026-07-30
- **Sample build:** https://dev.azure.com/dnceng-public/public/_build/results?buildId=1517682
The failures are test method cleanup failures (no error message captured), suggesting nondeterministic cleanup behavior in the task environment under Linux.
## Action
The test will be quarantined via `[ActiveIssue("")]` (from `Microsoft.DotNet.XUnitV3Extensions`, namespace `Xunit`) until the underlying nondeterminism is fixed.
> [!WARNING]
>
> Firewall blocked 2 domains
>
> The following domains were blocked by the firewall during workflow execution:
>
> - `awmgmcpg`
> - `southcentralus0.in.applicationinsights.azure.com`
>> To allow these domains, add them to the `network.allowed` list in your workflow frontmatter:
>
> ```yaml
> network:
> allowed:
> - defaults
> - "awmgmcpg"
> - "southcentralus0.in.applicationinsights.azure.com"
> ```
>
> 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/30630622840) · sonnet46 · 155.4 AIC · ⌖ 4.91 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
Start by locating Microsoft.Build.UnitTests.TaskEnvironment_Tests.TaskEnvironment_SetEnvironment_ShouldReplaceAllVariables in the Microsoft.Build.Engine.UnitTests assembly and review its cleanup behavior. Reproduce it on the CoreOnLinux leg for the Multithreaded and Stub environment types, then determine the nondeterministic cleanup cause. Done means the test is stable on net10.0 and net11.0 and no longer needs quarantine.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100