Skip to content

BrokenRulesCollection: InvalidOperationException: Collection was modified; #4649

@StefanOssendorf

Description

@StefanOssendorf

Describe the bug
When querying the BrokenRulesCollection with any kind of operation (Select, Any, ...) it's possible to provoke an InvalidOperationException: Collection was modified; enumeration operation may not execute.. This can happen when at the same time an async rule finishes and modifies the BrokenRulesCollection.

In our case it happend during myBO.BrokenRulesCollection.Any(br => br.Severity == severity).

Possible solution
I think we should somehow ensure we return a snapshot of the list to avoid these kind of error.

Version and Platform
CSLA version: 9.0.0
OS: Windows
Platform: WPF, ASP.NET Core

Stack Trace or Exception Detail
InvalidOperationException: Collection was modified; enumeration operation may not execute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions