microsoft / microsoft/aspire

[CI Failure] Flaky: AzureResourcePreparerTests.PipelineStepAfterBeforeStartCanInspectRoleAssignmentsForTargetAzureResource fails with 'Collection was modified' race condition

Open
#19,308 1 comment 0 reactions 0 assignees View on GitHub
ci-failure-cause test-failure
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

## Build Information

Build: https://github.com/microsoft/aspire/actions/runs/31638399292
Build error leg or test failing: Tests / Hosting.Azure / Hosting.Azure (ubuntu-latest) / `Aspire.Hosting.Azure.Tests.AzureResourcePreparerTests.PipelineStepAfterBeforeStartCanInspectRoleAssignmentsForTargetAzureResource`
Pull request: #19082

## Error Message

```
System.InvalidOperationException : Step 'validate-compute-environments' failed: Collection was modified; enumeration operation may not execute.
---- System.InvalidOperationException : Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at System.Linq.Enumerable.OfTypeIterator[TResult](IEnumerable source)+MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
```

## Description

Flaky: AzureResourcePreparerTests.PipelineStepAfterBeforeStartCanInspectRoleAssignmentsForTargetAzureResource fails with 'Collection was modified' race condition

**Type**: flaky-test

## Occurrences

| Date | Build | Job | PR |
|------|-------|-----|----|
| 2026-08-12 | [31638399292](https://github.com/microsoft/aspire/actions/runs/31638399292) | Tests / Hosting.Azure / Hosting.Azure (ubuntu-latest) | #19082 |

Contributor guide

Open the contributing guide

Research direction

Start by running Aspire.Hosting.Azure.Tests.AzureResourcePreparerTests.PipelineStepAfterBeforeStartCanInspectRoleAssignmentsForTargetAzureResource and reproduce the failure from build 31638399292. Inspect the validate-compute-environments step and the collection enumeration shown in the stack trace. Done means the test no longer fails with a Collection was modified error across repeated runs and CI.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
cloud, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.