we have encuntered an exception in the class ProjectAssemblyReferenceCollection:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at ActiproSoftware.Internal.Ov.get_Item(String ) at ActiproSoftware.Internal.Ov.Add(IAssembly assembly)
I have looked at the source code and found that there is missing a lock in the index overloads. While the actual insertion is secured by a lock in the base class SimpleSynchronizedCollection, the index operator uses foreach over the collection.
As a workaround I can add the locks myself, but I just wish the collections were really thread-safe and not just parts of it. With the old WinForms version we at least knew the classes were not thread-safe. But now some operations are thread-safe while others are not. And usually the problems are found by the customers or very late during development.
[Modified 2 months ago]
Best regards, Tobias Lingemann.