Skip to content

[CI] Hosting.Redis test fails with "Collection was modified" while creating redisinsight #15666

@davidfowl

Description

@davidfowl

Is there an existing issue for this?

  • I have searched the existing issues

Build information

Error

The failing leaf job appears unrelated to the HTTP command / ATS changes in the PR. The failure in the downloaded job logs is:

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.Linq.Enumerable.TryGetLast[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source)
   at Aspire.Hosting.ApplicationModel.ResourceExtensions.TryGetLastAnnotation[T](IResource resource) in /_/src/Aspire.Hosting/ApplicationModel/ResourceExtensions.cs:line 29
   at Aspire.Hosting.ApplicationModel.RedisResource.get_ConnectionStringExpression() in /_/src/Aspire.Hosting.Redis/RedisResource.cs:line 108
   at Aspire.Hosting.ApplicationModel.IResourceWithConnectionString.Aspire.Hosting.ApplicationModel.IValueWithReferences.get_References() in /_/src/Aspire.Hosting/ApplicationModel/IResourceWithConnectionString.cs:line 36

The surrounding log shows this happening while creating the redisinsight container resource:

Failed to create container resource redisinsight
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

Notes

  • The aggregate jobs Tests / Final Test Results and Final Results fail because of this leaf job.
  • This looks like a concurrency/race around resource annotations or connection-string dependency resolution in Redis hosting.
  • It may be flaky/intermittent; it surfaced on an unrelated PR.

Suggested investigation area

  • Aspire.Hosting.ApplicationModel.ResourceExtensions.TryGetLastAnnotation
  • Aspire.Hosting.Redis.RedisResource.ConnectionStringExpression
  • resource annotation mutation while dependency/reference enumeration is in progress

Additional failure detail

The failing test in the job appears to be:

  • Aspire.Hosting.Redis.Tests.RedisFunctionalTests.VerifyWithRedisInsightImportDatabases

The earlier stack trace excerpt captured the core exception block around the redisinsight container creation failure, but it was not the entire job log. The job summary includes this specific test name, and the failure occurs while creating the redisinsight resource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions