dotnet / dotnet/runtime

Test failure: System.Diagnostics.Tests.CounterSampleCalculatorTests.CounterSampleCalculator_ElapsedTime

Open
#133,750 1 comment 0 reactions 0 assignees View on GitHub
arch-x64 area-System.Diagnostics.PerformanceCounter blocking-clean-ci Known Build Error os-windows untriaged
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

## Build Information
Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1586573
Build error leg or test failing: System.Diagnostics.Tests.CounterSampleCalculatorTests.CounterSampleCalculator_ElapsedTime
Pull request: https://github.com/dotnet/runtime/pull/133388

## Error Message

```json
{
"ErrorMessage": [
"System.Diagnostics.Tests.CounterSampleCalculatorTests.CounterSampleCalculator_ElapsedTime [FAIL]",
"System.ComponentModel.Win32Exception : The process cannot access the file because it is being used by another process."
],
"ErrorPattern": "",
"BuildRetry": false,
"ExcludeConsoleLog": false
}
```

## Error Details

```text
System.Diagnostics.Tests.CounterSampleCalculatorTests.CounterSampleCalculator_ElapsedTime [FAIL]
System.ComponentModel.Win32Exception : The process cannot access the file because it is being used by another process.
Stack Trace:
at System.Diagnostics.PerformanceCounterLib.RegisterFiles(String arg0, Boolean unregister)
at System.Diagnostics.PerformanceCounterLib.RegisterCategory(String categoryName, PerformanceCounterCategoryType categoryType, String categoryHelp, CounterCreationDataCollection creationData)
at System.Diagnostics.PerformanceCounterCategory.Create(String categoryName, String categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData)
at System.Diagnostics.Tests.CounterSampleCalculatorTests.CreateCounter(String categoryName, PerformanceCounterType counterType)
at System.Diagnostics.Tests.CounterSampleCalculatorTests.CounterSampleCalculator_ElapsedTime()
```

This is a post-fix occurrence of the file-access-conflict failure family previously tracked by #105925 and mitigated by #117619.

### Known issue validation
**Build: :mag_right:** https://dev.azure.com/dnceng-public/public/_build/results?buildId=1586573
**Error message validated:** `[System.Diagnostics.Tests.CounterSampleCalculatorTests.CounterSampleCalculator_ElapsedTime [FAIL] System.ComponentModel.Win32Exception : The process cannot access the file because it is being used by another process.`]
**Result validation:** :white_check_mark: Known issue matched with the provided build.
**Validation performed at:** 9/11/2026 10:50:11 PM UTC

### Report

|Build|Repository|Test|Pull Request|
|---|---|---|---|
|[1586573](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1586573)|dotnet/runtime|[System.Diagnostics.Tests.CounterSampleCalculatorTests.CounterSampleCalculator_ElapsedTime](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1586573&view=ms.vss-test-web.build-test-results-tab&runId=43783836&resultId=140274)|dotnet/runtime#133388|
#### Summary
|24-Hour Hit Count|7-Day Hit Count|1-Month Count|
|---|---|---|
|0|1|1|

### Report

|Build|Repository|Test|Pull Request|
|---|---|---|---|
|[1586573](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1586573)|dotnet/runtime|[System.Diagnostics.Tests.CounterSampleCalculatorTests.CounterSampleCalculator_ElapsedTime](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1586573&view=ms.vss-test-web.build-test-results-tab&runId=43783836&resultId=140274)|dotnet/runtime#133388|
#### Summary
|24-Hour Hit Count|7-Day Hit Count|1-Month Count|
|---|---|---|
|0|0|1|

Contributor guide

Open the contributing guide

Research direction

Start with System.Diagnostics.Tests.CounterSampleCalculatorTests.CounterSampleCalculator_ElapsedTime and its CreateCounter call, then inspect the PerformanceCounterLib.RegisterFiles/RegisterCategory stack in the failing build. Re-run the reported test or build to confirm the file-access conflict, and consider the prior issues #105925 and #117619. Done means the test no longer fails with the Win32Exception.

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
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.