dotnet / dotnet/sdk

[AI discovered CI] LocalizeTemplateTests.CanRunTask fails cleaning locked directory

Open
#56,222 1 comment 1 reaction 2 assignees Claimed by @nagilson View on GitHub
agentic-workflows cookie Known Build Error live-build-incident Test Debt untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

## Build Information
- **Current build:** [1589638](https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1589638)
- **Branch:** `refs/heads/main`
- **Failing test:** `Microsoft.TemplateEngine.Authoring.Tasks.IntegrationTests.LocalizeTemplateTests.CanRunTask` in `Microsoft.TemplateEngine.Authoring.Tasks.IntegrationTests.dll`; Windows x64 FullFramework Helix job
- **Phase:** `test-execution`
- **failureType:** `test-assertion`
- **evidenceSources:** `helix-trx`
- **Matching prior build:** [1589073](https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1589073)
- **Failure fingerprint:** `test-execution|test-assertion|microsoft.templateengine.authoring.tasks.integrationtests.localizetemplatetests.canruntask|test-method-microsoft.templateengine.authoring.tasks.integrationtests.localizetemplatetests.canruntask-threw-exception-system.io.ioexception-the-process-cannot-access-the-file--because-it-is-being-used-by-another-process.`

## Failure History
The exact test and mechanism occurred in 2 independent builds in the supplied evidence: current build 1589638 and prior build 1589073. Both were batched CI runs on `refs/heads/main` with different commits. Surrounding supplied results include failures from other mechanisms and successful builds, but they do not establish a broader common cause. This is recurrence of the observed test failure, not proof that the underlying lock source is flaky or infrastructure-owned.

## Error Details
```text
Test method Microsoft.TemplateEngine.Authoring.Tasks.IntegrationTests.LocalizeTemplateTests.CanRunTask threw exception:
System.IO.IOException: The process cannot access the file \\?\ because it is being used by another process.
at System.IO.FileSystem.RemoveDirectoryInternal(String fullPath, Boolean topLevel, Boolean allowDirectoryNotEmpty)
at System.IO.FileSystem.RemoveDirectoryRecursive(String fullPath, WIN32_FIND_DATA& findData, Boolean topLevel)
at System.IO.FileSystem.RemoveDirectory(String fullPath, Boolean recursive)
at Microsoft.TemplateEngine.Authoring.Tasks.IntegrationTests.LocalizeTemplateTests.CanRunTask() in 45
```
Named test results were available from Helix TRX. No dump or console URL was supplied in the dossier.

## Root Cause Analysis
**Observed:** The named test throws `System.IO.IOException` while recursively removing a temporary directory; Windows reports that the path is still in use by another process. The failure is reported at the test cleanup call, not as a generic Helix monitor failure.

**Assessment:** The supported proximate cause is a file or directory handle still open when `CanRunTask` calls `Directory.Delete`/recursive directory removal. The dossier does not identify which process owns the handle or whether the test, a child process launched by it, or another test artifact failed to release it. The generic `Monitor Helix Jobs` failure is downstream orchestration context, not the cause.

**Confidence:** Medium.

**Alternatives / Unknowns:** The owning process and handle lifetime are unknown; possible contributors include an incompletely exited child process, delayed asynchronous file I/O, or host-side file scanning. No dump, process-handle trace, binlog, target-branch comparison, or source history was supplied, so SDK ownership of the underlying lock is not yet established.

## Suggested Investigation
Capture a Windows process/handle dump for the failing work item and identify the owner of the temporary-directory handle first. Then inspect `LocalizeTemplateTests.CanRunTask` around line 45 and the process/file-producing code it invokes to verify all streams and child processes are awaited and disposed before cleanup. Compare the test implementation and runtime/test-host versions between builds 1589073 and 1589638; use a targeted rerun only to determine reproducibility after the lock owner is known.

## Error Message
{"ErrorMessage":["Microsoft.TemplateEngine.Authoring.Tasks.IntegrationTests.LocalizeTemplateTests.CanRunTask","System.IO.IOException"],"BuildRetry":false,"ExcludeConsoleLog":false}

> Generated by [🕵️ CI Quality Investigator](https://github.com/dotnet/sdk/actions/runs/34403901034) · gpt56 · 1.26 AIC · ⌖ 0.772 AIC · ⊞ 30.5K · [◷](https://github.com/search?q=repo%3Adotnet%2Fsdk+is%3Aissue+%22gh-aw-workflow-call-id%3A+dotnet%2Fsdk%2Fci-quality-monitor%22&type=issues)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.